simulot / immich-go

An alternative to the immich-CLI command that doesn't depend on nodejs installation. It tries its best for importing google photos takeout archives.
GNU Affero General Public License v3.0
1.17k stars 34 forks source link

Ability to add assets to shared albums #300

Open jgoclawski opened 2 weeks ago

jgoclawski commented 2 weeks ago

Hi,

Love the tool! I'm in the process of migrating my and my wife's photos from Google Photos to Immich. We had a few shared albums in Google Photos - I was their owner and my wife would add her photos there. So in Immich I'm trying to have the same structure - an album owned by me, shared with my wife and her photos added there. My issue is that when import my wife's photos from Takeout, a new album is created in Immich, instead of the shared one being used.

E.g. - Immich has an album "Spain 2018" owned by User A. User B uploads assets using immich-go:

./immich-go -server http://xxx.xxx.xxx.xxx:3001 -key xxx -log-level info \
upload -album "Spain 2018" "/share/UserB/Google Photos/Spain 2018"

And a new album "Spain 2018" is created. I'd love to reuse the existing, shared album.

Looks like it's about getting Albums from Immich -> https://github.com/simulot/immich-go/blob/main/immich/albums.go#L23 Is there a chance to add shared=true to the API call? https://immich.app/docs/api/get-all-albums Maybe it could be controlled with a flag?

simulot commented 2 weeks ago

Immich-go place photos in the album with the exact same name. If this album is shared, the photos will be shared. If the album doesn't exist, immich-go creates it, not shared. you can share it in the application.

jgoclawski commented 2 weeks ago

Hi, thanks for you reply. Based on my experiments, I don't think that immich-go "sees" the albums that are shared, but owned by another user.

Consider the following scenario:

"User 2" has access to 3 albums:

When "User 2" uses immich-go it sees only "Album 2A" and "Album 2B". If I tell it to import assets to "Album 1B", it will not see it and create a new one with that name (owned by "User 2", not shared).

It's about how immich-go calls Immich API.

When "User 2" calls /api/albums, then 2 albums are returned: "Album 2A" and "Album 2B", so a bit like "albums owned by me". When "User 2" calls /api/albums?shared=true, then 2 different albums are returned "Album 2B" and "Album 1B", so a bit like "only shared albums, no matter who's the owner".

Would you consider adding the shared=true flag to the API call? It's what the web Immich UI does to list albums - it calls the API twice ( /api/albums + /api/albums?shared=true ) to get all the albums.

simulot commented 2 weeks ago

I'll check it