diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2023-02-02 07:50:34 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2023-02-02 07:50:34 +0300 |
commit | 209c6404eb274c9f31e6ce847d365ca82d1bdac9 (patch) | |
tree | 907ff5b651fd18c22eb7a9460a740ecff8f36c46 /check-ratio.py |
initial
Diffstat (limited to 'check-ratio.py')
-rwxr-xr-x | check-ratio.py | 24 |
1 files changed, 24 insertions, 0 deletions
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 |