misc code cleanup

This commit is contained in:
xenofem 2024-03-02 00:15:18 -05:00
parent 65017abe00
commit be99dc5578

View file

@ -692,7 +692,7 @@ def manual_collate(args):
work_collation_dir = collation_area / work_id work_collation_dir = collation_area / work_id
if work_collation_dir.exists(): if work_collation_dir.exists():
if len(list(work_collation_dir.iterdir())) > 0: if len(list(work_collation_dir.iterdir())) > 0:
print(f'Collation directory already exists!') print('Collation directory already exists!')
return return
else: else:
work_collation_dir.rmdir() work_collation_dir.rmdir()
@ -743,7 +743,7 @@ def analyze(args):
elif is_pdf(f): elif is_pdf(f):
sizes = pdf_image_sizes(f) sizes = pdf_image_sizes(f)
if len(sizes) == 0: if len(sizes) == 0:
print(f'\tContains no images') print('\tContains no images')
else: else:
print(f'\t{len(sizes)} images, median {fmt_size(median(sizes))}, min {fmt_size(min(sizes))}, max {fmt_size(max(sizes))}') print(f'\t{len(sizes)} images, median {fmt_size(median(sizes))}, min {fmt_size(min(sizes))}, max {fmt_size(max(sizes))}')
else: else:
@ -803,8 +803,6 @@ def generate(args):
collated_work_ids = {p.name for p in (site_dir / 'images').iterdir()} collated_work_ids = {p.name for p in (site_dir / 'images').iterdir()}
actual_series = {series for (series,) in cur.execute('SELECT series FROM works GROUP BY series HAVING count(series) > 1')}
works = [] works = []
for (work_id, title, circle, date, description, series) in cur.execute('SELECT id, title, circle, date, description, series FROM works ORDER BY date DESC').fetchall(): for (work_id, title, circle, date, description, series) in cur.execute('SELECT id, title, circle, date, description, series FROM works ORDER BY date DESC').fetchall():
if work_id not in collated_work_ids: if work_id not in collated_work_ids: