Fix: Preview in CLEANUP Mode with Filtering
Fixed preview of albums that would be deleted with --mode CLEANUP but without --delete-confirm not taking asset filtering into account
This commit is contained in:
parent
bbe6a08858
commit
544d697ffa
1 changed files with 18 additions and 14 deletions
|
@ -782,22 +782,26 @@ logging.info("%d existing albums identified", len(albums))
|
||||||
|
|
||||||
# mode CLEANUP
|
# mode CLEANUP
|
||||||
if mode == SCRIPT_MODE_CLEANUP:
|
if mode == SCRIPT_MODE_CLEANUP:
|
||||||
# Delete Confirm check
|
albums_to_delete = list()
|
||||||
if not delete_confirm:
|
|
||||||
print("Would delete the following albums:")
|
|
||||||
print(list(album_to_id.keys()))
|
|
||||||
if is_docker:
|
|
||||||
print("Run the container with environment variable DELETE_CONFIRM set to 1 to actually delete these albums!")
|
|
||||||
else:
|
|
||||||
print(" Call with --delete-confirm to actually delete albums!")
|
|
||||||
exit(0)
|
|
||||||
|
|
||||||
cpt = 0
|
|
||||||
for album in album_to_assets:
|
for album in album_to_assets:
|
||||||
if album in album_to_id:
|
if album in album_to_id:
|
||||||
album_to_delete = dict()
|
album_to_delete = dict()
|
||||||
album_to_delete['id'] = album_to_id[album]
|
album_to_delete['id'] = album_to_id[album]
|
||||||
album_to_delete['albumName'] = album
|
album_to_delete['albumName'] = album
|
||||||
|
albums_to_delete.append(album_to_delete)
|
||||||
|
|
||||||
|
# Delete Confirm check
|
||||||
|
if not delete_confirm:
|
||||||
|
print("Would delete the following albums:")
|
||||||
|
print([a['albumName'] for a in albums_to_delete])
|
||||||
|
if is_docker:
|
||||||
|
print("Run the container with environment variable DELETE_CONFIRM set to 1 to actually delete these albums!")
|
||||||
|
else:
|
||||||
|
print(" Call with --delete-confirm to actually delete albums!")
|
||||||
|
exit(0)
|
||||||
|
else:
|
||||||
|
cpt = 0
|
||||||
|
for album_to_delete in albums_to_delete:
|
||||||
if deleteAlbum(album_to_delete):
|
if deleteAlbum(album_to_delete):
|
||||||
logging.info("Deleted album %s", album_to_delete['albumName'])
|
logging.info("Deleted album %s", album_to_delete['albumName'])
|
||||||
cpt += 1
|
cpt += 1
|
||||||
|
|
Loading…
Reference in a new issue