From 736c15703fa015cbcfcfc4c55dede07a6ede929f Mon Sep 17 00:00:00 2001 From: Salvoxia <Salvoxia@blindfish.info> Date: Fri, 2 Aug 2024 20:09:42 +0200 Subject: [PATCH 1/4] README Minor formatting changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 78067b8..4898bca 100644 --- a/README.md +++ b/README.md @@ -242,7 +242,7 @@ Since Immich does not support real nested albums ([yet?](https://github.com/immi ## Cleaning Up Albums -The script supports differnt run modes (option -m/--mode or env variable `MODE` for Docker). The default mode is `CREATE`, which is used to create albums. +The script supports differnt run modes (option `-m`/`--mode` or env variable `MODE` for Docker). The default mode is `CREATE`, which is used to create albums. The other two modes are `CLEANUP` and `DELETE_ALL`: - `CLEANUP`: The script will generate album names using the script's arguments and the assets found in Immich, but instead of creating the albums, it will delete them (if they exist). This is useful if a large number of albums was created with no/the wrong `--album-separator` or `--album-levels` settings. - `DELETE_ALL`: ⚠️ As the name suggests, this mode blindly deletes ALL albums from Immich. Use with caution! From 67425b769ccc76361f96d4f45a74400c9f1d9a8f Mon Sep 17 00:00:00 2001 From: Salvoxia <Salvoxia@blindfish.info> Date: Sat, 3 Aug 2024 11:22:58 +0200 Subject: [PATCH 2/4] README Clarified syntax for passing negative album level ranges --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4898bca..c53fa0c 100644 --- a/README.md +++ b/README.md @@ -221,7 +221,7 @@ Albums created for `root_path = /external_libs/photos/Birthdays`: ### Album Level Ranges - It is possible to specify not just a nunmber for `album-levels`, but a range from level x to level y in the folder structure that should make up an album's name: + It is possible to specify not just a number for `--album-levels`, but a range from level x to level y in the folder structure that should make up an album's name: `--album-levels="2,3"` The range is applied to the folder structure beneath `root_path` from the top for positive levels and from the bottom for negative levels. Suppose the following folder structure for an external library with the script's `root_path` set to `/external_libs/photos`: @@ -236,7 +236,9 @@ Albums created for `root_path = /external_libs/photos/Birthdays`: - `2020 02 Feb` - `2020 08 Aug` -⚠️ Note that with negative `album-levels` or album level ranges, images from different parent folders will be mixed in the same album if they reside in sub-folders with the same name (see `Vacation` in example above). +⚠️ __Important:__ When passing negative ranges as album levels, you __must__ pass the argument in the form `--album-levels="-2,-2"`. Emphasis is on the equals sign `=` separating the option from the value. Otherwise, you might get an error `argument -a/--album-levels: expected one argument`! + +⚠️ __Attention:__ Note that with negative `album-levels` or album level ranges, images from different parent folders will be mixed in the same album if they reside in sub-folders with the same name (see `Vacation` in example above). Since Immich does not support real nested albums ([yet?](https://github.com/immich-app/immich/discussions/2073)), neither does this script. From 0eab3adde0124eb12a5389686b2afa416677f7ed Mon Sep 17 00:00:00 2001 From: Salvoxia <Salvoxia@blindfish.info> Date: Mon, 5 Aug 2024 19:56:44 +0200 Subject: [PATCH 3/4] Docker Fixed parsing of ROOT_PATHs containing blanks --- docker/immich_auto_album.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) mode change 100644 => 100755 docker/immich_auto_album.sh diff --git a/docker/immich_auto_album.sh b/docker/immich_auto_album.sh old mode 100644 new mode 100755 index 069bb76..1dba064 --- a/docker/immich_auto_album.sh +++ b/docker/immich_auto_album.sh @@ -1,16 +1,20 @@ #!/usr/bin/env sh -# parse comma separated root paths -root_paths=$(echo "$ROOT_PATH" | tr "," "\n") +# parse comma separated root paths and wrap in quotes +oldIFS=$IFS +IFS=',' +# disable globbing +set -f main_root_path="" additional_root_paths="" -for path in ${root_paths}; do +for path in ${ROOT_PATH}; do if [ -z "$main_root_path" ]; then - main_root_path="$path" + main_root_path="\"$path\"" else - additional_root_paths="-r $path $additional_root_paths" + additional_root_paths="-r \"$path\" $additional_root_paths" fi done +IFS=$oldIFS unattended= if [ ! -z "$UNATTENDED" ]; then From 2fcb915688639b0aea1084f90aac0aa93876e96c Mon Sep 17 00:00:00 2001 From: Salvoxia <Salvoxia@blindfish.info> Date: Wed, 14 Aug 2024 18:03:16 +0000 Subject: [PATCH 4/4] README Updated compatibility statement with 1.112.x --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c53fa0c..25ac76e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This is a python script designed to automatically create albums in [Immich](http This is useful for automatically creating and populating albums for external libraries. Using the provided docker image, the script can simply be added to the Immich compose stack and run along the rest of Immich's containers. -__Current compatibility:__ Immich v1.111.x and below +__Current compatibility:__ Immich v1.112.x and below ## Disclaimer This script is mostly based on the following original script: [REDVM/immich_auto_album.py](https://gist.github.com/REDVM/d8b3830b2802db881f5b59033cf35702) @@ -253,4 +253,4 @@ To prevent accidental deletions, setting the mode to `CLEANUP` or `DELETE_ALL` a To actually delete albums, the option `-d/--delete-confirm` (or env variable `DELETE_CONFIRM` for Docker) must be set. __WARNING ⚠️__ -Deleting albums cannot be undone! The only option is to let the script run again and create new albums base on the passed arguments and current assets in Immich. \ No newline at end of file +Deleting albums cannot be undone! The only option is to let the script run again and create new albums base on the passed arguments and current assets in Immich.