summaryrefslogtreecommitdiff
path: root/check-ratio.py
diff options
context:
space:
mode:
Diffstat (limited to 'check-ratio.py')
-rwxr-xr-xcheck-ratio.py24
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