Only purge deleted files, empty albums within the cwd.
This commit is contained in:
parent
968d84b3cb
commit
84b35c3eaa
1 changed files with 18 additions and 2 deletions
|
@ -284,14 +284,30 @@ def init_argparse(args):
|
||||||
|
|
||||||
def purge_deleted_files_argparse(args):
|
def purge_deleted_files_argparse(args):
|
||||||
photodb = find_photodb()
|
photodb = find_photodb()
|
||||||
for deleted in photodb.purge_deleted_files():
|
|
||||||
|
if args.photo_id_args or args.photo_search_args:
|
||||||
|
photos = get_photos_from_args(args)
|
||||||
|
else:
|
||||||
|
photos = search_in_cwd(yield_photos=True, yield_albums=False)
|
||||||
|
|
||||||
|
for deleted in photodb.purge_deleted_files(photos):
|
||||||
print(deleted)
|
print(deleted)
|
||||||
|
|
||||||
if args.autoyes or interactive.getpermission('Commit?'):
|
if args.autoyes or interactive.getpermission('Commit?'):
|
||||||
photodb.commit()
|
photodb.commit()
|
||||||
|
|
||||||
def purge_empty_albums_argparse(args):
|
def purge_empty_albums_argparse(args):
|
||||||
photodb = find_photodb()
|
photodb = find_photodb()
|
||||||
for deleted in photodb.purge_empty_albums():
|
|
||||||
|
# We do not check args.album_search_args because currently it is not
|
||||||
|
# possible for search results to find empty albums on account of the fact
|
||||||
|
# that albums are only yielded when they contain some result photo.
|
||||||
|
if args.album_id_args:
|
||||||
|
albums = get_albums_from_args(args)
|
||||||
|
else:
|
||||||
|
albums = photodb.get_albums_within_directory(pathclass.cwd())
|
||||||
|
|
||||||
|
for deleted in photodb.purge_empty_albums(albums):
|
||||||
print(deleted)
|
print(deleted)
|
||||||
|
|
||||||
if args.autoyes or interactive.getpermission('Commit?'):
|
if args.autoyes or interactive.getpermission('Commit?'):
|
||||||
|
|
Loading…
Reference in a new issue