Salvoxia / immich-folder-album-creator

Automatically create and populate albums in Immich from a folder structure in external libraries
https://hub.docker.com/r/salvoxia/immich-folder-album-creator
222 stars 13 forks source link

Missing albums #41

Closed carlosjfcasero closed 2 months ago

carlosjfcasero commented 2 months ago

Hi! I'm facing an issue when trying to dry-run album creation. The folder I'm trying to scan contains following structure:

drwxr-xr-x 30 www-data www-data   4096 Feb 18  2023  2015
drwxr-xr-x 59 www-data www-data   4096 Feb 18  2023  2016
drwxr-xr-x 38 www-data www-data   4096 Feb 18  2023  2017
drwxr-xr-x 55 www-data www-data   4096 Feb 18  2023  2018
drwxr-xr-x 81 www-data www-data   4096 Feb 17  2023  2019
drwxr-xr-x 54 www-data www-data   4096 Feb 17  2023  2020
drwxr-xr-x 78 www-data www-data   4096 Jun 11  2023  2021
drwxr-xr-x 73 www-data www-data   4096 Jun 11  2023  2022
drwxr-xr-x 26 www-data www-data   4096 Aug 14 15:25  2023
drwxrwxr-x 14 www-data www-data   4096 Aug 16 12:09  2024
drwxr-xr-x  4 www-data www-data   4096 Apr 16 23:56  Álbumes
drwxr-xr-x 29 www-data www-data   4096 Mar  2  2023  Carlos
drwxr-xr-x  2 www-data www-data   4096 Feb 17  2023 'Concierto de Navidad'
drwxr-xr-x  8 www-data www-data   4096 Feb 18  2023  Paula
drwxr-xr-x  4 www-data www-data   4096 Jun 29 21:53  Revisar
-rwxr-xr-x  1 www-data www-data 600716 Apr 28  2021  Screenshot_20190716_090847_com.whatsapp.jpg
drwxr-xr-x  4 www-data www-data   4096 Jun 24 11:35  Uploaded

and 2015 folder has 27 folders (with images inside) and 1 image.

When running following command docker run -e API_URL="https://tld/api" -e API_KEY="XXX" -e ROOT_PATH="/usr/src/app/nextcloud" -e ALBUM_LEVELS="2" -e IGNORE="2017" -e LOG_LEVEL="DEBUG" salvoxia/immich-folder-album-creator:latest /script/immich_auto_album.sh I'm getting following albums (just showing the ones with errors):

time=2024-09-04T14:07:01.501+00:00 level=INFO msg=469 albums identified
time=2024-09-04T14:07:01.501+00:00 level=INFO msg=Album list: ['2015 Carlos', '2015 Nochevieja', '2015 Varios (de Carlos)', '2015 new born Carlitos', '2016', ...

I can see two issues here:

Am I doing something wrong?

Salvoxia commented 2 months ago

Hi,

nothing obviously wrong that I can see. From the top of my head I can think of the following explanations:

Can you please check if any of these points might apply?

Best Regards, Salvoxia

carlosjfcasero commented 2 months ago

Hi @Salvoxia. That was exactly my problem. I previously ran the script with album_level=1 so an album called "2015" was already created. I deleted that album and new albums were created. Thanks a lot!

carlosjfcasero commented 2 months ago

I was just wondering if an enhancement could be done to allow same image to be part of two albums. For example, for the root path /a/b, --album_level=1 --allow_duplicates=true, it would be nice to have an album 'a' with 'a' elements together with 'b' elements and another 'b' album just with 'b' elements

Salvoxia commented 2 months ago

Absolutely possible. You would have to run the script with different combinations of root_path, and --album-levels when specifying --allow-duplicates. Example:

/external_libs/photos/A/1.jpg
/external_libs/photos/A/B/2.jpg

Running with root_path = /external_libs/photos and --album-levels = 1 would create an album

Album A
 - 1.jpg
 - 2.jpg

After that, running with root_path = /external_libs/photos and --album-levels = 2 and --alow-duplicates = true would create then create the following album:

Album A B
 - 2.jpg

It would also create Album A with 1.jpg, but since Album A already exists an 1.jpg is already assigned to it, nothing changes here.

Is that would you mean?

carlosjfcasero commented 2 months ago

That's exactly what I mean! Just to confirm, right now it's not possible due to technical limitations, it would be needed a PR, right?

Salvoxia commented 2 months ago

That's correct. A PR is welcome, otherwise I'll implement it myself :)

carlosjfcasero commented 2 months ago

I'm afraid I don't know how to do it in Python, sorry 😢

Salvoxia commented 2 months ago

Implemented in #43 and available in the latest Docker image. Will be included in the next release.

Salvoxia commented 2 months ago

Released with version 0.10.0.

carlosjfcasero commented 2 months ago

Thank you so much!