From 209c6404eb274c9f31e6ce847d365ca82d1bdac9 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Thu, 2 Feb 2023 07:50:34 +0300 Subject: initial --- check-ratio.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 check-ratio.py (limited to 'check-ratio.py') diff --git a/check-ratio.py b/check-ratio.py new file mode 100755 index 0000000..bd546bf --- /dev/null +++ b/check-ratio.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +from database import Database +from argparse import ArgumentParser + + +if __name__ == '__main__': + db = Database() + parser = ArgumentParser() + parser.add_argument('--from', type=str, required=True, dest='date_from', + help='date formatted as yyyy-mm-dd') + parser.add_argument('--to', type=str, required=True, dest='date_to', + help='date formatted as yyyy-mm-dd') + args = parser.parse_args() + + docs = db.get_documents((args.date_from, args.date_to)) + for doc in docs: + pages = db.get_doc_pages(doc['collection_id'], doc['doc_id']) + for page, width, height, dpi in pages: + if width == 0 or height == 0: + print(f'ERROR: {doc["collection_id"]}/{doc["page_id"]}/{page}: width or height is zero') + continue + ratio = width/height + # TODO + # print(f'[]') \ No newline at end of file -- cgit v1.2.3