@Salvoxia thank you for such a useful tool! Much needed!
I have a scenario where the main album with an unexpected album name and which holds all photos cannot be deleted. It may just be my wrongdoing, though.
In a setup where immich is running as a docker and an external library is set as well and mapped as...
home/user/USBdrive/Photos:/usr/src/app/external
and
home/user/USBdrive/Photos
home/user/USBdrive/Photos/Family Photos
home/user/USBdrive/Photos/Family Photos/Trips
home/user/USBdrive/Photos/Family Photos/Trips/Trip 001
home/user/USBdrive/Photos/Family Photos/Trips/Trip 001
...
home/user/USBdrive/Photos/Family Photos/Trips/Trip 099
When running immich-folder-album-creator docker (Raspbian (Debian 12 bookworm)
sudo docker run --rm -e API_URL="https://website.com/api/" -e API_KEY="123" -e ROOT_PATH="/usr/src/app/external" -e ALBUM_LEVELS=3 -e LOG_LEVEL=INFO salvoxia/immich-folder-album-creator:latest /script/immich_auto_album.sh
the following albums are created
usb src
Family Photos Trips Trip 001
...
Family Photos Trips Trip 099
Albums named "Family Photos Trips Trip xxx" can be deleted (one by one) but album "usb src" cannot. A message reports it cannot be deleted, the log shows:
[Nest] 6 - 05/19/2024, 11:39:37 AM WARN [ImmichServer] [ExpressAdapter] Content-Type doesn't match Reply body, you might need a custom ExceptionFilter for non-JSON responses
[Nest] 6 - 05/19/2024, 11:40:57 AM ERROR [ImmichServer] [QueryFailedError: bind message has 18802 parameter formats but 0 parameters
at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async DeleteQueryBuilder.execute (/usr/src/app/node_modules/typeorm/query-builder/DeleteQueryBuilder.js:52:33)
at async SubjectExecutor.executeRemoveOperations (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:461:17)
at async SubjectExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:104:9)
at async EntityPersistExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/EntityPersistExecutor.js:140:21)
at async AlbumRepository.delete (/usr/src/app/dist/repositories/album.repository.js:230:9)
at async AlbumService.delete (/usr/src/app/dist/services/album.service.js:153:9)] Failed to delete album
[Nest] 6 - 05/19/2024, 11:40:57 AM ERROR [ImmichServer] [QueryFailedError: bind message has 18802 parameter formats but 0 parameters
at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async DeleteQueryBuilder.execute (/usr/src/app/node_modules/typeorm/query-builder/DeleteQueryBuilder.js:52:33)
at async SubjectExecutor.executeRemoveOperations (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:461:17)
at async SubjectExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:104:9)
at async EntityPersistExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/EntityPersistExecutor.js:140:21)
at async AlbumRepository.delete (/usr/src/app/dist/repositories/album.repository.js:230:9)
at async AlbumService.delete (/usr/src/app/dist/services/album.service.js:153:9)] QueryFailedError: bind message has 18802 parameter formats but 0 parameters
The assumption here was setting
-e ROOT_PATH="/usr/src/app/external"
as
-e ROOT_PATH="/home/user/USBdrive/Photos"
would not find the photos.
If I manually remove all albums and run
sudo docker run --rm -e API_URL="https://website.com/api/" -e API_KEY="123" -e ROOT_PATH="/usr/src/app/external/Family Photos" -e ALBUM_LEVELS=3 -e LOG_LEVEL=INFO salvoxia/immich-folder-album-creator:latest /script/immich_auto_album.sh
It will still show album "usr src":
time=2024-05-19T10:40:16.713+00:00 level=INFO msg=Requesting all assets
time=2024-05-19T10:40:29.913+00:00 level=INFO msg=42169 photos found
time=2024-05-19T10:40:29.913+00:00 level=INFO msg=Sorting assets to corresponding albums using folder name
time=2024-05-19T10:40:30.098+00:00 level=INFO msg=1 albums identified
time=2024-05-19T10:40:30.098+00:00 level=INFO msg=Album list: [' usr src']
time=2024-05-19T10:40:30.098+00:00 level=INFO msg=Listing existing albums on immich
time=2024-05-19T10:40:30.393+00:00 level=INFO msg=1 existing albums identified
time=2024-05-19T10:40:30.393+00:00 level=INFO msg=Creating albums if needed
time=2024-05-19T10:40:30.393+00:00 level=INFO msg=0 albums created
time=2024-05-19T10:40:30.394+00:00 level=INFO msg=Adding assets to albums
time=2024-05-19T10:40:32.476+00:00 level=INFO msg=Done!
Is there a way to reset and begin from scratch? So that it correctly identifies the folder structure? It may have to do with setting the root path differently. Or a way to have the main album with all photos be properly named as "Family Photos" as per ROOT_PATH setting?
Thank you for any feedback in advance.