]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/musicxml2ly.py
Fix disappearing last page problem.
[lilypond.git] / scripts / musicxml2ly.py
index 66774fa672ed0361ad85a6ada01e33975f8e7c56..c29daed136ca268bd0ff01c85504943b0a3be894 100644 (file)
@@ -7,20 +7,9 @@ import os
 import string
 from gettext import gettext as _
 
-
-
-for d in ['@lilypond_datadir@',
-          '@lilypond_libdir@']:
-    sys.path.insert (0, os.path.join (d, 'python'))
-
-# dynamic relocation, for GUB binaries.
-bindir = os.path.abspath (os.path.split (sys.argv[0])[0])
-for p in ['share', 'lib']:
-    datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p)
-    sys.path.insert (0, datadir)
-
-
-
+"""
+@relocate-preamble@
+"""
 
 import lilylib as ly
 
@@ -208,8 +197,11 @@ def musicxml_note_to_lily_main_event (n):
         event = musicexp.RestEvent()
     elif n.instrument_name:
         event = musicexp.NoteEvent ()
-        event.drum_type = instrument_drumtype_dict[n.instrument_name]
-        
+        try:
+            event.drum_type = instrument_drumtype_dict[n.instrument_name]
+        except KeyError:
+            n.message ("drum %s type unknow, please add to instrument_drumtype_dict" % n.instrument_name)
+            event.drum_type = 'acousticsnare'
     
     if not event:
         n.message ("cannot find suitable event")
@@ -264,7 +256,8 @@ class LilyPondVoiceBuilder:
         diff = moment - current_end
         
         if diff < Rational (0):
-            raise NegativeSkip(current_end, moment)
+            print 'Negative skip', diff
+            diff = Rational (0)
 
         if diff > Rational (0):
             skip = musicexp.SkipEvent()
@@ -588,7 +581,7 @@ def print_score_setup (printer, part_list, voices):
 
 def print_ly_preamble (printer, filename):
     printer.dump_version ()
-    printer.print_verbatim ('%% converted from %s\n' % filename)
+    printer.print_verbatim ('%% automatically converted from %s\n' % filename)
 
 def read_musicxml (filename, use_lxml):
     if use_lxml: