mirror of
https://github.com/kastdeur/pipeband-music.git
synced 2024-12-22 16:23:31 +01:00
Title can be set for a set file
This commit is contained in:
parent
ed9ba6aa0b
commit
55dad71d0e
1 changed files with 28 additions and 7 deletions
31
make-set
31
make-set
|
@ -6,7 +6,8 @@ from argparse import ArgumentParser
|
|||
|
||||
parser = ArgumentParser(__file__)
|
||||
parser.add_argument('setfile')
|
||||
parser.add_argument('-c',dest='copy',action='store_true',default=False)
|
||||
parser.add_argument('-c',dest='copy',action='store_true',default=False,help="Copy files instead of just linkingi")
|
||||
parser.add_argument('-t',dest='title',help="Title for the set")
|
||||
parser.add_argument('scores',nargs='+')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
@ -15,10 +16,30 @@ if os.path.isdir(args.setfile):
|
|||
print("First argument cannot be a directory ")
|
||||
sys.exit()
|
||||
|
||||
if os.path.dirname(args.setfile):
|
||||
os.makedirs(os.path.dirname(args.setfile), exist_ok=True)
|
||||
|
||||
if args.setfile == '--':
|
||||
fprint = print
|
||||
else:
|
||||
fpoint = codecs.open(args.setfile, 'w+', 'utf8')
|
||||
fpoint.write(u'\ufeff')
|
||||
fpoint.write('\\version \"2.18.2\"\n\n')
|
||||
fprint = fpoint.write
|
||||
|
||||
fprint(u'\ufeff')
|
||||
fprint('\\version \"2.18.2\"\n\n')
|
||||
|
||||
if args.title:
|
||||
fprint(
|
||||
"\header {"+
|
||||
"title = \"" + args.title + "\""+
|
||||
"}\n")
|
||||
|
||||
fprint(
|
||||
"\paper {"+
|
||||
"#(define page-breaking ly:minimal-breaking)" +
|
||||
"}\n")
|
||||
|
||||
fprint("\n\n%Scores\n")
|
||||
|
||||
for f in args.scores:
|
||||
|
||||
|
@ -38,8 +59,8 @@ for f in args.scores:
|
|||
incline = os.path.join(os.path.abspath(os.path.dirname(f)), incline)
|
||||
|
||||
line = "\\include \""+incline+"\""
|
||||
fpoint.write(line.replace('\r', '')+'\n')
|
||||
fprint(line.replace('\r', '')+'\n')
|
||||
else:
|
||||
fpoint.write('\\include \"' + os.path.join( os.path.abspath( os.curdir ) ,f) + '\"\n')
|
||||
fprint('\\include \"' + os.path.join( os.path.abspath( os.curdir ) ,f) + '\"\n')
|
||||
|
||||
fpoint.close()
|
||||
|
|
Loading…
Reference in a new issue