diff musiccutter.py @ 8:f07a997e9f79

Engrave filename and page number.
author Daniel O'Connor <darius@dons.net.au>
date Sat, 02 Apr 2016 23:26:38 +1030
parents 31db42ce72b8
children e9760224e992
line wrap: on
line diff
--- a/musiccutter.py	Sat Apr 02 23:06:48 2016 +1030
+++ b/musiccutter.py	Sat Apr 02 23:26:38 2016 +1030
@@ -74,7 +74,10 @@
         print 'Playable count:', playablecount
         print 'Unplayable count:', unplayablecount
 
-        for svg in svgs:
+        for i in range(len(svgs)):
+            svg = svgs[i]
+            svg.add(svg.text('%s (%d / %d)' % (midifile, i + 1, npages), fill = 'black', stroke = 'black',
+                            insert = ('%.3fcm' % (0), '%.3fcm' % (self.pageheight))))
             svg.save()
 
     # http://www.electronics.dit.ie/staff/tscarff/Music_technology/midi/midi_note_numbers_for_octaves.htm
@@ -128,7 +131,7 @@
     def _emitnote(svg, x, y, w, h):
         svg.add(svgwrite.shapes.Rect(insert = ('%.3fcm' % (x), '%.3fcm' % (y)),
                                      size = ('%.3fcm' % (w), '%.3fcm' % (h)),
-                                    stroke = 'red', stroke_width = '1px', fill = 'red'))
+                                     stroke = 'red', stroke_width = '1px', fill = 'red'))
 
 if __name__ == '__main__':
     main()