handle edge-case where we need to manual-collate the top-level directory of an extracted work

This commit is contained in:
xenofem 2024-01-22 08:47:20 -05:00
parent 01f5955844
commit 578a46c217

View file

@ -210,8 +210,11 @@ def collate(args):
con.close()
def self_and_parents(path):
return [path] + list(path.parents)
def manual_collate(args):
work_id = args.paths[0].relative_to(args.destdir / 'extract').parents[-2].name
work_id = self_and_parents(args.paths[0].relative_to(args.destdir / 'extract'))[-2].name
collation_dir = args.destdir / 'site' / 'images' / work_id
if collation_dir.exists() and len(list(collation_dir.iterdir())) > 0: