Engine for LaTeX songbooks http://www.patacrep.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.1 KiB

#!/usr/bin/python
# -*- coding: utf-8 -*-
#
from songbook.build import buildsongbook
import getopt
import json
import locale
import os.path
import sys
def usage():
print "No usage information yet."
def main():
locale.setlocale(locale.LC_ALL, '') # set script locale to match user's
try:
opts, args = getopt.getopt(sys.argv[1:],
12 years ago
"hs:l:",
["help","songbook=","library="])
except getopt.GetoptError, err:
# print help and exit
print str(err)
usage()
sys.exit(2)
12 years ago
sbFile = None
library = './'
for o, a in opts:
if o in ("-h", "--help"):
usage()
sys.exit()
elif o in ("-s", "--songbook"):
12 years ago
sbFile = a
elif o in ("-l", "--library"):
if not a.endswith('/'):
a += '/'
library = a
else:
assert False, "unhandled option"
12 years ago
basename = os.path.basename(sbFile)[:-3]
12 years ago
f = open(sbFile)
sb = json.load(f)
f.close()
buildsongbook(sb, basename, library)
if __name__ == '__main__':
main()