This Python script is designed to emulate the smart albums from Google Photos for Immich. This will aggregate "people" in an album automatically.
The config.json.example
file contains the following settings:
isFirtsRun
: This setting processes all images and adds them to the album; if set to false, only the last 100 pictures are processed.accounts
: this will be the list of accounts to contribute to the album, each user that uses the app and will contribute to an album is required to generate an API key that will be used to add the photos to the shared albumaccoutnName
: name of the account, not used for logic just for informationapiKey
: user account API key, follow this instructions of how to generate oneurl
: URL to the you immich instance in the following format: somelocation.com/api. example: http://127.0.0.1:3001/apialbuns
: this will contain the list of albuns that the current account will contribute with photosid
: album ID, this can be seen in the URL when you open a album, example: bbdf5884-925a-40eb-bc4e-ac66a186c82fname
: name of the album, not used for logic just for informationpersons
: the list of people that the user has in his account and wants to add to the albumid
: "people" id, this can be seen in the URL when you open a "people". example: 9cdaf954-9f92-43a8-b79d-4a4f71640db3name
: name of the person, not used for logic just for information
- Create a album that you whant to use as the "Smart album" and share it with all the users that should contribute to it.
- On each user account generate an API key and add that account to the config.
- for each account added add the album with the correct album ID to the albuns configuration. you can add any amount of albuns
- for each album added add the people id from that account to the persons configuration. You can add any amount of people to each album
- repeat this steps for each account that you want.
-
Make sure you have Python installed on your system.
-
Update the configuration in the 'config.json' file with your desired settings.
-
Run the script using the following command:
python ImmichAutoAlbum.py
-
Update the
crontab
file with the desired interval for checking the Media, this file will be used by the container to schedule the actions. The current configuration will check every day at midnight:0 0 * * * /usr/local/bin/python3 /app/ImmichAutoAlbum.py > /proc/1/fd/1 2>/proc/1/fd/2
-
Build the Docker image:
docker build -t immich_auto_album .
-
Run the Docker container:
docker run -d --name immich_auto_album immich_auto_album