]> git.donarmstrong.com Git - lilypond.git/commitdiff
MusicXML: No crash on note without <duration>, escape lyrics with parentheses
authorReinhold Kainhofer <reinhold@kainhofer.com>
Fri, 7 Sep 2007 14:55:44 +0000 (16:55 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Fri, 7 Sep 2007 14:55:44 +0000 (16:55 +0200)
If lyrics syllables contain parentheses ( or ), we also need to wrap that
syllables in quotes.

It seems that some scanning applications write out some notes without a
<duration> child element. Work around this case and use a default value
instead of crashing. The user has to adjust the .ly file anyway.

python/musicxml.py
scripts/musicxml2ly.py

index e4d06a2a0af3411a5fbab252f22f84570a40dcd0..543e47786bc03b8456f572f9954f04ea31a57769 100644 (file)
@@ -5,7 +5,7 @@ import re
 
 def escape_ly_output_string (input_string):
     return_string = input_string
 
 def escape_ly_output_string (input_string):
     return_string = input_string
-    needs_quotes = re.search ("[0-9\" ,._-]", return_string);
+    needs_quotes = re.search ("[-0-9\" ,._()]", return_string);
     return_string = string.replace (return_string, "\"", "\\\"")
     if needs_quotes:
         return_string = "\"" + return_string + "\""
     return_string = string.replace (return_string, "\"", "\\\"")
     if needs_quotes:
         return_string = "\"" + return_string + "\""
index daf52ec43cc22ed397b6319cbdad4aabd2b988e6..e3dd61dcd0c7cd72e080fc205db1c6c82732abb9 100644 (file)
@@ -73,7 +73,11 @@ def print_ly_information (printer, score_information):
 def musicxml_duration_to_lily (mxl_note):
     d = musicexp.Duration ()
     if mxl_note.get_maybe_exist_typed_child (musicxml.Type):
 def musicxml_duration_to_lily (mxl_note):
     d = musicexp.Duration ()
     if mxl_note.get_maybe_exist_typed_child (musicxml.Type):
-        d.duration_log = mxl_note.get_duration_log ()
+        duration_log = mxl_note.get_duration_log ()
+        if duration_log:
+            d.duration_log = mxl_note.get_duration_log ()
+        else:
+            d.duration_log = 0
     else:
         d.duration_log = 0
 
     else:
         d.duration_log = 0