Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import xml.etree.ElementTree as ET
- import zipfile
- import sys
- # reads from a musescore save file and outputs the text in the order typically shown on the sheet.
- # not finished, i.e. arguments are not implemented, but functional. Dashses are not supported.
- for a in sys.argv:
- if not a is None:
- print(a) # args ..
- zarchive = zipfile.ZipFile('1.mscz')
- tree = ET.parse(zarchive.open('1.mscx'))
- chords = tree.findall('.//Chord')
- text = []
- for chord in chords:
- count = 0;
- for lyrics in chord.iter('Lyrics'):
- for l in lyrics.iter('text'):
- for k in l.itertext():
- if count >= len(text):
- text.append('')
- text[count] += k
- text[count] += ' '
- count += 1
- # print text
- for t in text:
- print(t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement