]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/pmx2ly.py
* Another grand 2003 update.
[lilypond.git] / scripts / pmx2ly.py
index c462713be9350feef777773315d948eba58ec76d..7328ed1505f46b13ec87b87534db7ddc5200dc3f 100644 (file)
@@ -162,6 +162,7 @@ class Voice:
                
        def last_chord (self):
                return self.chords[-1]
+       
        def add_chord (self, ch):
                self.chords.append (ch)
                self.entries.append (ch)
@@ -258,9 +259,11 @@ class Staff:
                        v.number = i
                        i = i+1
        def set_clef (self, letter):
-               clstr = clef_table[letter]
-               self.voices[0].add_nonchord (Clef (clstr))
-
+               if clef_table.has_key (letter):
+                       clstr = clef_table[letter]
+                       self.voices[0].add_nonchord (Clef (clstr))
+               else:
+                       sys.stderr.write ("Clef type `%c' unknown\n" % letter)
        
        def current_voice (self):
                return self.voices[self.voice_idx]
@@ -600,7 +603,7 @@ Huh? expected duration, found %d Left was `%s'""" % (durdigit, str[:20]))
                        numbers = numbers + map (atonum, opening)
 
                (no_staffs, no_instruments, timesig_num, timesig_den, ptimesig_num,
-                ptimesig_den, pickup_beats,keysig_number) = tuple (numbers[0:8])
+                esig_den, pickup_beats,keysig_number) = tuple (numbers[0:8])
                (no_pages,no_systems, musicsize, fracindent) = tuple (numbers[8:])
 
                # ignore this.
@@ -765,11 +768,13 @@ Huh? Unknown directive `%s', before `%s'""" % (c, left[:20] ))
                ls = open (fn).readlines ()
                def subst(s):
                        return re.sub ('%.*$', '', s)
+               
                ls = map (subst, ls)
+               ls = filter (lambda x: x <> '\n', ls)
                ls = self.parse_header (ls)
                left = string.join (ls, ' ')
 
-               print left
+#              print left
                self.parse_body (left)
                for c in self.staffs:
                        c.calculate ()
@@ -805,7 +810,7 @@ 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--2002 by Han-Wen Nienhuys <hanwen@cs.uu.nl>
+Copyright (c)  2000--2003 by Han-Wen Nienhuys <hanwen@cs.uu.nl>
 """ % version)
 def identify():
        sys.stderr.write ("%s from LilyPond %s\n" % (program_name, version))