diff --git a/dlibrary.py b/dlibrary.py index 15d5079..c721202 100755 --- a/dlibrary.py +++ b/dlibrary.py @@ -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: