let manual-collate automatically deduce the work id from the paths

This commit is contained in:
xenofem 2024-01-22 07:36:23 -05:00
parent 6c94a346c4
commit e1b2741253

View file

@ -202,7 +202,9 @@ def collate(args):
con.close() con.close()
def manual_collate(args): def manual_collate(args):
collation_dir = args.destdir / 'site' / 'images' / args.work_id work_id = args.paths[0].relative_to(args.destdir / 'extract').parents[-2].name
collation_dir = args.destdir / 'site' / 'images' / work_id
if collation_dir.exists() and len(list(collation_dir.iterdir())) > 0: if collation_dir.exists() and len(list(collation_dir.iterdir())) > 0:
print(f'Collation directory already exists!') print(f'Collation directory already exists!')
return return
@ -346,7 +348,6 @@ parser_collate.add_argument(
parser_collate.set_defaults(func=collate) parser_collate.set_defaults(func=collate)
parser_manual_collate = subparsers.add_parser('manual-collate', help='collate a specific work manually, specifying all paths to include') parser_manual_collate = subparsers.add_parser('manual-collate', help='collate a specific work manually, specifying all paths to include')
parser_manual_collate.add_argument('work_id')
parser_manual_collate.add_argument( parser_manual_collate.add_argument(
'paths', 'paths',
metavar='PATH', metavar='PATH',