]> git.donarmstrong.com Git - lilypond.git/blobdiff - python/musicxml.py
Merge branch 'lilypond/translation' of ssh://jomand@git.sv.gnu.org/srv/git/lilypond...
[lilypond.git] / python / musicxml.py
index 9d6fa054dbddd136b8184021dc0fbfe97ccdb46a..7c398e1e5d7a5f73a97b3a25d22bcbf37122f289 100644 (file)
@@ -5,9 +5,9 @@ from rational import *
 import re
 import sys
 import copy
-import lilylib
+import lilylib as ly
 
-_ = lilylib._
+_ = ly._
 
 def error (str):
     ly.stderr_write ((_ ("error: %s") % str) + "\n")
@@ -51,7 +51,7 @@ class Xml_node:
        return ''.join ([c.get_text () for c in self._children])
 
     def message (self, msg):
-        lilylib.stderr_write (msg+'\n')
+        ly.stderr_write (msg+'\n')
 
         p = self
         while p:
@@ -179,6 +179,16 @@ class Identification (Xml_node):
         return self.get_encoding_information ('encoder')
     def get_encoding_description (self):
         return self.get_encoding_information ('encoding-description')
+    
+    def get_encoding_software_list (self):
+        enc = self.get_named_children ('encoding')
+        software = []
+        for e in enc:
+            softwares = e.get_named_children ('software')
+            for s in softwares:
+                software.append (s.get_text ())
+        return software
+
 
 
 class Duration (Music_xml_node):
@@ -330,7 +340,7 @@ class Note (Measure_element):
                     'half': 1,
                     'whole': 0,
                     'breve': -1,
-                    'long': -2}.get (log, 0)
+                    'longa': -2}.get (log, 0)
        elif self.get_maybe_exist_named_child (u'grace'):
            # FIXME: is it ok to default to eight note for grace notes?
            return 3
@@ -369,7 +379,7 @@ class Part_list (Music_xml_node):
         if instrument_name:
             return instrument_name
         else:
-            lilylib.stderr_write (_ ("Unable to find find instrument for ID=%s\n") % id)
+            ly.stderr_write (_ ("Unable to find find instrument for ID=%s\n") % id)
             return "Grand Piano"
 
 class Part_group (Music_xml_node):
@@ -943,7 +953,9 @@ def get_class (name):
 def lxml_demarshal_node (node):
     name = node.tag
 
-    if name is None:
+    # TODO: This is a nasty hack, but I couldn't find any other way to check
+    #       if the given node is a comment node (class _Comment):
+    if name is None or re.match (u"^<!--.*-->$", node.__repr__()):
         return None
     klass = get_class (name)
     py_node = klass()