+Options:
+ -h,--help print this help
+ -o,--output=FILE set output filename to FILE
+ -v,--version show version information
+ -r,--ref=REF read background information from ref-file REF
+
+Musedata (http://www.ccarh.org/musedata/) is an electronic library of
+classical music scores, currently comprising XXX scores. The music is
+encoded in so-called Musedata format
+(http://www.ccarh.org/publications/books/beyondmidi/online/musedata).
+musedata2ly converts a set of musedata files to one .ly file, and will
+include a \header field if a .ref file is supplied.
+
+This converter is not complete -- this is left to the user as an excercise.
+
+Report bugs to bug-lilypond@gnu.org.
+
+Written by Han-Wen Nienhuys <hanwen@cs.uu.nl>.
+
+""")
+
+
+def print_version ():
+ sys.stdout.write ("""musedata2ly (GNU LilyPond) %s
+
+This is free software. It is covered by the GNU General Public License,
+and you are welcome to change it and/or distribute copies of it under
+certain conditions. Invoke as `midi2ly --warranty' for more information.
+
+Copyright (c) 2000--2004 by Han-Wen Nienhuys <hanwen@cs.uu.nl>.
+""" % version)
+def identify():
+ sys.stderr.write ("%s from LilyPond %s\n" % (program_name, version))
+
+
+
+(options, files) = getopt.getopt (sys.argv[1:], 'r:vo:h', ['verbose', 'ref=', 'help','version', 'output='])
+out_filename = None
+ref_file = None
+for opt in options:
+ o = opt[0]
+ a = opt[1]
+ if o== '--help' or o == '-h':
+ help ()
+ sys.exit (0)
+ elif o == '--version' or o == '-v':
+ print_version ()
+ sys.exit(0)
+ elif o == '--ref' or o == '-r':
+ ref_file = a
+ elif o == '--output' or o == '-o':
+ out_filename = a
+ elif o == '--verbose' :
+ verbose = 1
+ else:
+ print o
+ raise getopt.error
+
+identify()
+
+
+
+ly = ''
+
+
+found_ids = ''
+
+for f in files:
+ if f == '-':
+ f = ''
+
+ sys.stderr.write ('Processing `%s\'\n' % f)