[Cvs-annodex] commit (annodex): cmmlwiki/trunk/setup.py
+cmmlwiki/trunk/scripts/cmmlwiki-batch-import
conrad
nobody at lists.annodex.net
Tue Jun 13 07:52:08 UTC 2006
Update of /var/local/lib/svn/annodex (new revision 2329)
Added files:
cmmlwiki/trunk/scripts/cmmlwiki-batch-import
Modified files:
cmmlwiki/trunk/setup.py
Log Message:
add cmmlwiki-batch-import script by shans + conrad
Added: cmmlwiki/trunk/scripts/cmmlwiki-batch-import
===================================================================
--- cmmlwiki/trunk/scripts/cmmlwiki-batch-import 2006-06-09 06:53:11 UTC (rev 2328)
+++ cmmlwiki/trunk/scripts/cmmlwiki-batch-import 2006-06-13 07:52:07 UTC (rev 2329)
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2005 CSIRO Australia
+#
+# Based on sample code from the Python/XML HOWTO:
+# http://pyxml.sourceforge.net/topics/howto/xml-howto.html
+#
+# You may find this script to be a useful example of processing CMML in
+# python. Improvements and bugfixes welcome :-)
+#
+# Conrad Parker <conrad at annodex.net>, Mar 3 2005
+
+import sys
+import os
+
+if __name__=='__main__':
+
+ try:
+ envpath = sys.argv[1]
+ spec_name = sys.argv[2]
+ except IndexError:
+ print "Usage: cmmlwiki-import </path/to/wikienv/> file.spec"
+ sys.exit(1)
+
+ # os.path.join: "if any component is an absolute path, all previous
+ # components are thrown away, and joining continues."
+ # -- http://docs.python.org/lib/module-os.path.html
+ # ie. if an absolute path to spec_name is given, then it's dirname
+ # ends up as the result of media_dir; otherwise, media_dir is evaluated
+ # relative to the current working directory.
+ media_dir = os.path.join (os.getcwd(), os.path.dirname(spec_name))
+
+ f = open (spec_name, "r")
+ for line in f:
+ (wikiname, cmml_file, ogg_file) = line.split ()
+
+ cmml_file = os.path.join (media_dir, cmml_file)
+ ogg_file = os.path.join (media_dir, ogg_file)
+
+ os.system("cmmlwiki-admin %s add %s %s" % (envpath, wikiname, ogg_file))
+ os.system("cmmlwiki-import %s %s %s" % (envpath, wikiname, cmml_file))
Property changes on: cmmlwiki/trunk/scripts/cmmlwiki-batch-import
___________________________________________________________________
Name: svn:executable
+ *
Modified: cmmlwiki/trunk/setup.py
===================================================================
--- cmmlwiki/trunk/setup.py 2006-06-09 06:53:11 UTC (rev 2328)
+++ cmmlwiki/trunk/setup.py 2006-06-13 07:52:07 UTC (rev 2329)
@@ -77,6 +77,12 @@
if copied:
self.outfiles.append(ofile)
+ ofile, copied = self.copy_file(os.path.join(self.build_dir,
+ 'cmmlwiki-batch-import'),
+ self.install_dir)
+ if copied:
+ self.outfiles.append(ofile)
+
cgi_dir = os.path.join(self.install_data, 'share', 'cmmlwiki', 'cgi-bin')
if not os.path.exists(cgi_dir):
os.makedirs(cgi_dir)
@@ -126,6 +132,7 @@
(_p('share/cmmlwiki/htdocs/javascripts'), glob(_p('htdocs/javascripts/*')))],
scripts=[_p('scripts/cmmlwiki-admin'),
_p('scripts/cmmlwiki-import'),
+ _p('scripts/cmmlwiki-batch-import'),
_p('cgi-bin/cmmlwiki.cgi'),],
cmdclass = {'install': my_install,
'install_scripts': my_install_scripts,
--
conrad
More information about the cvs-annodex
mailing list