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

New option for Album name levels #2

Closed wnaude closed 6 months ago

wnaude commented 6 months ago

Hi, thanks for this very promising script. I have not yet tried it, because of my following requirement for album names.

Will it be possible to add an argument for album_name_levels? Let me explain with the following folder structure

2023
--2023-01
  --Vacation
--2023-02
--2023-03
--2023-04
  --Birdwatching
--2023-05

So I would prefer that the album names may contain up to 3 folder levels, but you can set the default value to 1 to retain existing behavior.

So with a setting of 3, my album names would look like this: 2023_2023-01 2023_2023-01_Vacation 2023_2023-02 2023_2023-03 2023_2023-04 2023_2023-04_Birdwatcing

For your kind consideration please.

Salvoxia commented 6 months ago

Thanks for your interest! Yes, I think that's absolutely doable. Give me a couple of days to look into it.

Salvoxia commented 6 months ago

I just pushed a new version of the script that supports two new arguments:

options:
  -a ALBUM_LEVELS, --album-levels ALBUM_LEVELS
                        Number of levels of sub-folder for which to create separate albums (default: 1)
  -s ALBUM_SEPARATOR, --album-separator ALBUM_SEPARATOR
                        Separator string to use for compound album names created from nested folders (default: )

-a behaves exactly as you described. -s is the string used to combine nested folder names into a complete album name. The default is a blank.

2023
--2023-01
  --Vacation

An album created from the above structure with -a 3 would be called 2023 2023-01 Vacation. If you were to use -a 2 -s " - ", it would be called 2023 - 2023-01 and contain all images from 2023-01 and from 2023-01/Vacation.

Please test the script in master branch or use the Docker container with the latest tag. If it works for you as expected (it did in my own tests), I'll build a new release with updated README.

wnaude commented 6 months ago

Wow, working 1st time!

47 albums created for my sample data. Now I can continue importing the rest of my external libraries.

Big thanks for your quick and efficient assistance,

Salvoxia commented 6 months ago

Released with v0.2.0.