39 lines
907 B
Python
Executable File
39 lines
907 B
Python
Executable File
#!/usr/bin/env python3
|
|
import sys
|
|
import os
|
|
import inspect
|
|
|
|
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
|
|
parentdir = os.path.dirname(currentdir)
|
|
parentparentdir = os.path.dirname(parentdir)
|
|
sys.path.insert(0, parentparentdir)
|
|
|
|
import getopt
|
|
import django
|
|
from django.conf import settings
|
|
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'procat2.settings')
|
|
django.setup()
|
|
|
|
from markup.pdf import parse_pdf
|
|
|
|
|
|
def main(argv):
|
|
def usage():
|
|
print('usage: %s [-d] file ...' % argv[0])
|
|
return 100
|
|
try:
|
|
(opts, args) = getopt.getopt(argv[1:], 'd')
|
|
except getopt.GetoptError:
|
|
return usage()
|
|
if not args: return usage()
|
|
debug = 0
|
|
for (k, v) in opts:
|
|
if k == '-d': debug += 1
|
|
|
|
(prods, scribbles) = parse_pdf(args[0], debug)
|
|
print('prods', scribbles)
|
|
|
|
|
|
if __name__ == '__main__': sys.exit(main(sys.argv))
|