forked from CryHavoc/dottes
31 lines
677 B
Python
Executable File
31 lines
677 B
Python
Executable File
#!/usr/bin/env python
|
|
#
|
|
# Write out a modified version of a .abc file with just the data
|
|
# to print the first line of the music only.
|
|
#
|
|
|
|
import sys
|
|
|
|
def process(inf):
|
|
print "X:1"
|
|
for line in inf:
|
|
line = line.strip()
|
|
start = line[:2]
|
|
if start[0] != "|" and start[1] == ":":
|
|
if start[0] in ["M", "K", "L"]:
|
|
print line
|
|
elif start[0] != "%":
|
|
print line
|
|
if line[-1] != "\\":
|
|
break
|
|
|
|
if len(sys.argv) > 1:
|
|
for arg in sys.argv[1:]:
|
|
try:
|
|
inf = open(arg, "r")
|
|
process(inf)
|
|
finally:
|
|
inf.close()
|
|
else:
|
|
process(sys.stdin)
|