aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-11-19 22:34:47 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-11-19 22:34:47 +0000
commite6cb7154cad711087524d20c074cf23ec13f6054 (patch)
tree8287015fd03d0e2afa65effa6f17933bb724d8e8 /scripts
parent8efea516e943d70802ffd4d79781c072d4822251 (diff)
created a script to automatically generate a PDDP_META file using some guesses for meta types. It creates all of the meta fields in a subpatch called [pd PDDP_META]
svn path=/trunk/; revision=3975
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generate-libdir-metafile.sh74
1 files changed, 74 insertions, 0 deletions
diff --git a/scripts/generate-libdir-metafile.sh b/scripts/generate-libdir-metafile.sh
new file mode 100755
index 00000000..78c3fe83
--- /dev/null
+++ b/scripts/generate-libdir-metafile.sh
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+# this script is used to generate a mylibrary/mylibrary.pd meta file. This
+# file is read for relevant meta data when a libdir is opened. (That's the
+# plan at least) <hans@at.or.at>
+
+# keeps track of where the last bit of text was printed so that new text is
+# not printed on top of existing text
+Y=10
+
+# Usage: print_pd_text($to_file, $meta_type, $text_to_print)
+function print_pd_text ()
+{
+ file_name="$1"; shift
+ meta_type="$1"; shift
+ echo "#X text 10 $Y ${meta_type}: $@;" >> "$file_name"
+ ((Y=Y+20))
+}
+
+if [ $# -lt 2 ]; then
+ echo "Usage: $0 BASE_DIR LIBNAME [ meta types ] "
+ echo " --author"
+ echo " --copyright"
+ echo " --description"
+ echo " --keywords"
+ echo " --license"
+else
+
+BASE_DIR="$1"; shift
+LIBNAME="$1"; shift
+libdir_file_name="${BASE_DIR}/${LIBNAME}/${LIBNAME}.pd"
+# create pd file
+touch "${libdir_file_name}"
+
+# create .pd header with subpatch called "PDDP_META"
+echo "#N canvas 10 10 200 200 10;" >> "${libdir_file_name}"
+echo "#N canvas 20 20 420 300 PDDP_META 0;" >> "${libdir_file_name}"
+#N canvas 249 280 600 398 loc&precess 0;
+
+# add required meta fields
+print_pd_text "${libdir_file_name}" PDDP_META "this is a prototype of a libdir meta file"
+print_pd_text "${libdir_file_name}" NAME ${LIBNAME}
+
+
+# get meta data types:
+while [ $# -ge 1 ]; do
+ case $1 in
+ --author)
+ print_pd_text "${libdir_file_name}" AUTHOR "$2"
+ ;;
+ --copyright)
+ print_pd_text "${libdir_file_name}" COPYRIGHT "$2"
+ ;;
+ --description)
+ print_pd_text "${libdir_file_name}" DESCRIPTION "$2"
+ ;;
+ --keywords)
+ print_pd_text "${libdir_file_name}" KEYWORDS "$2"
+ ;;
+ --license)
+ print_pd_text "${libdir_file_name}" LICENSE "$2"
+ ;;
+ *)
+ echo "ERROR: unknown flag: $1 with data: $2"
+ ;;
+ esac
+ shift
+ shift
+done
+
+echo "#X restore 10 10 pd PDDP_META;" >> "${libdir_file_name}"
+
+
+fi