markup: pass workdir around, don't recalc all the time

This commit is contained in:
2019-10-19 22:08:42 -07:00
parent ed5236c618
commit e434d3f705
5 changed files with 28 additions and 31 deletions

View File

@ -3,9 +3,9 @@ from .pdf import parse_pdf
from .utils import overlaps
def find_marked_products(pdf, subdir, catname, debug=0):
def find_marked_products(pdf, workdir, debug=0):
"""Main entry point. Give a pdf, get matches."""
(prods, scribbles) = parse_pdf(pdf, subdir, catname, debug)
(prods, scribbles) = parse_pdf(pdf, workdir, debug)
if not prods or len(prods) < 1:
print('no product placement markers found')
@ -15,7 +15,7 @@ def find_marked_products(pdf, subdir, catname, debug=0):
matches = find_matches(prods, scribbles, 0.10)
for s in scribbles:
write_debug_image(subdir, catname, s['page'], prods, scribbles)
write_debug_image(workdir, s['page'], prods, scribbles)
return matches