# HG changeset patch # User Daniel O'Connor # Date 1459601798 -37800 # Node ID f07a997e9f79153996476e17da584493d50f347c # Parent 31db42ce72b8b44f6ca6e9ff8a7259620854d95f Engrave filename and page number. diff -r 31db42ce72b8 -r f07a997e9f79 musiccutter.py --- 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()