feat: add support to use a start date

This commit is contained in:
2026-07-27 23:53:53 +01:00
parent db1b0ad124
commit 6fcb874640
4 changed files with 15 additions and 6 deletions
+5 -4
View File
@@ -1,9 +1,9 @@
# Immich automatic Person -> Album
Automatically add people (faces) to an album and keep that album up-to-date. You can then share that automatic person-album
Automatically add people (faces) to an album and keep that album up-to-date. You can then share that automatic person-album
with another user (for example, a shared album of your children).
You can arbitrarily add any face/person to any album. So you could make a "Family" album which contains all your family
You can arbitrarily add any face/person to any album. So you could make a "Family" album which contains all your family
members and is automatically updated.
You can use API keys from any number of Immich users, so the one Docker container can handle doing automatic
@@ -42,6 +42,7 @@ Alternatively, you can add the configuration inline in your `docker-compose.yml`
{
"immichServer": "http://192.168.0.20:2283",
"schedule": "*/30 * * * *",
"startDate": "2026-07-27T00:00:00.000Z",
"users": [
{
"apiKey": "XXXXXXXXXX", # Immich user's API key (read-only access)
@@ -67,11 +68,11 @@ Alternatively, you can add the configuration inline in your `docker-compose.yml`
6. Give it a name
7. Add the permissions of `asset.read` and `albumAsset.create`
8. Click **Create**
9. Copy the new API key and put it in your config file
9. Copy the new API key and put it in your config file
### Get your person and album IDs
Person IDs:
Person IDs:
- Immich → Explore → People → Click person → Copy ID from URL
- Example URL: http://your-server/people/f3437c84-83f9-4e84-9640-0dcd12efd08e
+8 -2
View File
@@ -31,6 +31,7 @@ export class PersonToAlbum {
async processPerson (link: Link) {
let nextPage: string | null = '1'
let mostRecent
const updateKey = this.getUpdateKeyName(link)
if (link.description) console.log(`=== ${link.description} ===`)
console.log(`Adding person ${link.personId} to album ${link.albumId}`)
@@ -43,11 +44,16 @@ export class PersonToAlbum {
// the asset was updated in Immich, and nothing to do with the EXIF data.
// https://immich.app/docs/api/get-asset-info
// This may also be the case for `created`, but it doesn't specify that in the docs.
updatedAfter: store.get(this.getUpdateKeyName(link)),
updatedAfter: store.get(updateKey) || this.config.startDate,
page: parseInt(nextPage, 10), // why is `nextPage` a string and `page` a number? ¯\_(ツ)_/¯
personIds: [link.personId]
}
})
if (!res.assets.items.length) {
nextPage = res.assets.nextPage
continue
}
// Track the most recent photo timestamp so we can update the store
if (!mostRecent) mostRecent = res.assets.items[0].updatedAt
@@ -61,7 +67,7 @@ export class PersonToAlbum {
}
// Store the most recent asset update value so we can start processing only newer items next time.
await store.set(this.getUpdateKeyName(link), mostRecent)
if (mostRecent) await store.set(this.getUpdateKeyName(link), mostRecent)
console.log()
}
+1
View File
@@ -1,6 +1,7 @@
export interface Config {
immichServer: string;
schedule: string;
startDate: string;
users: User[]
}
+1
View File
@@ -1,6 +1,7 @@
{
"immichServer": "http://192.168.0.20:2283",
"schedule": "*/30 * * * *",
"startDate": "2026-07-27T00:00:00.000Z",
"users": [
{
"apiKey": "",