25 lines
985 B
Python
Executable File
25 lines
985 B
Python
Executable File
#!/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
|
|
if ratio >= 0.8:
|
|
print(f'{doc["collection_id"]}/{doc["doc_id"]}/{page}: {ratio}')
|