Skip to content

Commit

Permalink
Merge pull request #60 from Salvoxia/fix/albumCleanupPreviewFilter
Browse files Browse the repository at this point in the history
Fix: Preview in CLEANUP Mode with Filtering
  • Loading branch information
Salvoxia authored Sep 27, 2024
2 parents 79332b4 + 544d697 commit 7390d18
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions immich_auto_album.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,28 +781,32 @@ def setAlbumThumbnail(albumId: str, assetId: str):
logging.info("%d existing albums identified", len(albums))

# mode CLEANUP
if mode == SCRIPT_MODE_CLEANUP:
if mode == SCRIPT_MODE_CLEANUP:
albums_to_delete = list()
for album in album_to_assets:
if album in album_to_id:
album_to_delete = dict()
album_to_delete['id'] = album_to_id[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(list(album_to_id.keys()))
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)

cpt = 0
for album in album_to_assets:
if album in album_to_id:
album_to_delete = dict()
album_to_delete['id'] = album_to_id[album]
album_to_delete['albumName'] = album
else:
cpt = 0
for album_to_delete in albums_to_delete:
if deleteAlbum(album_to_delete):
logging.info("Deleted album %s", album_to_delete['albumName'])
cpt += 1
logging.info("Deleted %d/%d albums", cpt, len(album_to_assets))
exit(0)
logging.info("Deleted %d/%d albums", cpt, len(album_to_assets))
exit(0)


# mode CREATE
Expand Down

0 comments on commit 7390d18

Please sign in to comment.