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
181 stars 9 forks source link

How to prevent album creation per date ? #58

Open pbranly opened 1 week ago

pbranly commented 1 week ago

Hi All my folders are grouped by subjects as "anniversary" and under "anniversary x", "anniversary y" ..... Album creation works fine but are created first under "Year" What are the settings in the configuration to keep the first level of each album as the folders ? Thanks Phil

Salvoxia commented 1 week ago

Hi,

I'm not sure if I understand your folder structure correctly. This is what I understand that it looks like:

/external_libs/photos/
├── 2020/
│   ├── Anniversary X/
│   └── Anniversary Y/
└── 2021/
    ├── Anniversary X/
    └── Anniversary Y/

And with your root path set to /external_libs/photos you now get these Albums:

2020 Anniversary X
2020 Anniversary Y
2021 Anniversary X
2021 Anniversary Y

but want only these albums:

Anniversary X (with images from 2020/Anniversary X AND 2021/Anniversary X)
Anniversary Y (with images from 2020/Anniversary Y AND 2021/Anniversary Y)

Is that correct?

If so, what you want is --album-levels="2,2" to only take the 'second part' of the album name. Refer to Album Level Ranges in the README.

If did not understand that correctly please correct me by modifying my example.

Best Regards, Salvoxia

pbranly commented 1 week ago

Hi Thank you for the answer but it is not really like that; my folder structure is as the following screen copy (from immich but consistant with the reality) 2024-09-26_17-43 and this what I get: 2024-09-26_17-46 So for "anniversaires" folder (birthday) I just have a line that groups all the anniversaries from 1986 to 2001 under the year "2001" I would like the album structure organised as the folders Thanks Phil

pbranly commented 1 week ago

this what I gat with synology photo: 2024-09-26_17-58

Salvoxia commented 1 week ago

Ok, I get it now.
However, I'm afraid you're out of luck since Immich does not support nested albums (yet).

It this point you're left with two options:

  1. The way you have it now, i.e. the images of all <year> Anniversaire ... folders in a single Anniversaire album
  2. A separate album for each year, but here you have multiple naming options
    • <year> Anniversaire ...
    • Anniversaire: <year> Anniversaire ...
pbranly commented 4 days ago

Hi Could you explain the configuration of ALBUM_LEVELS ? I tried to add a line with a value of 2 in the env file but after restart it did not change anything in albums then I added a line ALBUM_LEVELS: 2 in the docker compose environment but again no change Thanks Philippe

Salvoxia commented 4 days ago

From your description you configured it correctly. However, there's one thing to remember: With the default settings, the script will only create albums for images that are not already part of an album.

So if there are still the albums from your previous tries with the script, these image will not be detected. You have two ways to counter this:

  1. Specifiy FIND_ASSETS_IN_ALBUMS: true in your environment. This way, the you keep the old albums and the new ones with ALBUM_LEVELS: 2 will be created as well (refer to Assets in Multiple Albums in the README).
  2. Perform a run with MODE: CLEANUP and the old ALBUM_LEVELS setting first. This will try to identify the same albums as before, but it will delete them. If you do not specify DELETE_CONFIRM: true as well, this is a dry run and it will only log which albums would be deleted (see Cleaning up Albums in README).
pbranly commented 4 days ago

Hi Thanks I have fixed the issue by removing each album from immich. Then restarted the container and got the new albums But where do I have to set the album_level value ? In the docker compose file or just in the .env file ? I have both now so I don't know which one works and doc is not clear for that when using docker compose file Thanks Phil

Salvoxia commented 4 days ago

This is more a general Docker question than specific to the script. The script only sees the environment variable that Docker passes to it. Where Docker gets that from doesn't matter. So it doesn't matter whether you specify the variable in the .env file or in the environment attribute directly in the compose file.

In your current situation where it's specified in both places, judging from the Docker Environment Variable Precedence Documentation, it sounds like the one in environment takes precedence over the one in the .env file.