]> git.donarmstrong.com Git - lilypond.git/blobdiff - buildscripts/output-distance.py
increase time-performance importance.
[lilypond.git] / buildscripts / output-distance.py
index 5aa5dfcb6e0f4d292c14bce9be1cf1cb1b13fe1a..07f8705e3fb7983e2b560f84fbd9a47ec61748fd 100644 (file)
@@ -7,9 +7,7 @@ import math
 ## so we can call directly as buildscripts/output-distance.py
 me_path = os.path.abspath (os.path.split (sys.argv[0])[0])
 sys.path.insert (0, me_path + '/../python/')
-
-
-import safeeval
+sys.path.insert (0, me_path + '/../python/out/')
 
 
 X_AXIS = 0
@@ -385,8 +383,6 @@ class FileLink:
         return self.file_names[oldnew]
     
     def html_record_string (self, dest_dir):
-        self.link_files_for_html (dest_dir)
-        
         dist = self.distance()
         
         details = self.get_distance_details ()
@@ -394,7 +390,7 @@ class FileLink:
             details_base = os.path.splitext (self.file_names[1])[0]
             details_base += '.details.html'
             fn = dest_dir + '/'  + details_base
-            open (fn, 'w').write (details)
+            open_write_file (fn).write (details)
 
             details = '<br>(<a href="%(details_base)s">details</a>)' % locals ()
 
@@ -512,7 +508,7 @@ class ProfileFileLink (FileCompareLink):
                     note_info, self.contents[oldnew])
 
         dist = 0.0
-        factor = {'time': 1.0 ,
+        factor = {'time': 2.0 ,
                   'cells': 10.0,
                   }
         
@@ -523,19 +519,30 @@ class ProfileFileLink (FileCompareLink):
         return dist
 
     
-class MidiFileLink (FileCompareLink):
-    def get_content (self, f):
-        s = FileCompareLink.get_content (self, f)
-        s = re.sub ('LilyPond [0-9.]+', '', s)
-        return s
-    
-    def get_cell (self, oldnew):
+class MidiFileLink (TextFileCompareLink):
+    def get_content (self, oldnew):
+        import midi
+        
+        data = FileCompareLink.get_content (self, oldnew)
+        midi = midi.parse (data)
+        tracks = midi[1]
+
         str = ''
-        if oldnew == 1 and self.distance () > 0:
-            str = 'changed' 
+        j = 0
+        for t in tracks:
+            str += 'track %d' % j
+            j += 1
+
+            for e in t:
+                ev_str = repr (e)
+                if re.search ('LilyPond [0-9.]+', ev_str):
+                    continue
+                
+                str += '  ev %s\n' % `e`
         return str
     
 
+
 class SignatureFileLink (FileLink):
     def __init__ (self, f1, f2 ):
         FileLink.__init__ (self, f1, f2)
@@ -922,7 +929,12 @@ class ComparisonData:
 
         dest_file = dest_dir + '/index.html'
         open_write_file (dest_file).write (html)
+
+
+        for link in changed:
+            link.link_files_for_html (dest_dir)
         
+
     def print_results (self, threshold):
         self.write_text_result_page ('', threshold)