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.9k stars 55 forks source link

Feature/tags #512

Closed benjamonnguyen closed 3 weeks ago

benjamonnguyen commented 1 month ago

Description

Verification

test command: immich-go upload -tags="test" -tag-with-session -tag-with-path ~/test immich-go-tags

tobiasgraeber commented 1 month ago

@benjamonnguyen Maybe also add the new option by something like -tags="YOUR-TAG-NAME" to the readme.md table which lists common commands like here ?: https://github.com/benjamonnguyen/immich-go/tree/feature/tags?tab=readme-ov-file#shared-options-with-all-commands

@simulot Can this be merged please?

Thx!

benjamonnguyen commented 1 month ago

@tobiasgraeber updated the readme!

benjamonnguyen commented 1 month ago

Let's actually hold off on merging this.

I'm seeing an issue where sometimes assets aren't being tagged.

Opened an issue here: https://github.com/immich-app/immich/issues/13633

simulot commented 1 month ago

I'm wondering if it possible to leverage the tagging system to track immich-go uploads, and implement a kind of UNDO.

benjamonnguyen commented 1 month ago

I can definitely see immich-go upload -tag-session tagging all uploaded assets with the same format log files are suffixed with. Then immich-go delete -tags=20241022xx.

I can add the -tag-session flag to this PR.

benjamonnguyen commented 1 month ago

@simulot implemented tag-session flag:

image

For now I've had to add a 5 second sleep. It looks like there's a race condition where the assets are being moved out of the upload directory into the library directory resulting in a stale path when the tagAssets request is made.

Waiting on a response from the immich team.

simulot commented 1 month ago

@simulot implemented tag-session flag: image

Nice! The session tag could be hierarchical has well. All upload would be under one master tag like "immich-go/session_2006-01-02_15-04-05"

For now I've had to add a 5 second sleep. It looks like there's a race condition where the assets are being moved out of the upload directory into the library directory resulting in a stale path from the tagAssets request is made.

Waiting on a response from the immich team.

Let's see how the discussion goes.

simulot commented 1 month ago

Thinking loud: Imagine your personal collection of assets is sorted patiently by years, topic and so one... 2009 / Petrified forest 2009 / Grand canyon 2009 / Cousins meeting ...

Using the path as tags makes sense, isn't it?

benjamonnguyen commented 1 month ago

Using the path as tags makes sense, isn't it?

Silly of me to not think of this considering it's what motivated this PR in the first place. My wife has her folder structure like

|--Holidays
   |-- New Years
   |-- Halloween
   |-- Thanksgiving

and simply providing a flag -tag-by-path would be ideal.

Running list of possible flags... -tag-by-path -tag-with-session -tags

benjamonnguyen commented 1 month ago

@simulot Got a workaround from an immich maintainer (https://github.com/immich-app/immich/discussions/13637#discussioncomment-11017586)

If things look ok to you, I think it's mergeable

agittins commented 1 month ago

How about a -tag-by-path-separators to further split the path component by a given set of chars?

My existing archive has folders named 2024/2024-02-05-event-name-or-such, and I have subfolders named out for results of processing.

If that's a bit esoteric it's no problem for me, as I'll just use a bash script to call immich-go for each folder separately, building the tags list for each folder as it goes.

But either way, I'm keen to see this merged! :-)

benjamonnguyen commented 4 weeks ago

@agittins I think the 3 current flags covers our bases and a bash script leveraging them would be a cleaner

benjamonnguyen commented 3 weeks ago

@simulot after using it to upload and tag a few of my wife's albums, I think it'll be a cleaner CLI to break it out into its own tag command and treat it as a two step process. Upload then tag. Am also planning to implement -remove-tags=LIST and -tag-cleanup.

simulot commented 3 weeks ago

This could be one of the maintenance tools that we can propose through immich-go

fyi: I'm still on the code reorganization

simulot commented 3 weeks ago

The immich-go next version is more mature now. Could you envisage to port the tag functionality in the next branch? Feel free to discuss this

simulot commented 3 weeks ago

Don't rush on it... I'm still shaking the code

benjamonnguyen commented 3 weeks ago

If you don't mind, do you have a summary of the direction your taking with this next branch?

benjamonnguyen commented 3 weeks ago

I'll move the changes onto the next branch but you can look at my latest commits if you want to see the new tag command's options and implementation.

simulot commented 3 weeks ago

I changed completely the command line management. I think I made it too difficult for a easy merge. I'll do it.

simulot commented 3 weeks ago

I'm ready to merge your PR. The next branch is so different now, than I don't know where to start while keep you credited for the feature.

benjamonnguyen commented 3 weeks ago

Are you going to merge next into main branch?

simulot commented 3 weeks ago

Can we chat on discord?

benjamonnguyen commented 3 weeks ago

Sure can you link me to the channel?

simulot commented 3 weeks ago

I'm reviewing your PR in details.

1/ I'm sorry for having shacked all the source while you have worked on it. 2/ I would like to include the tag functionality in the upload command. Then it will be available for any source of photos 3/ I'm think to group immich editing functions like tag maintenance, raw/jpeg cleaning, stack bursts....

My channel is @simulot, Paris time zone.

benjamonnguyen commented 3 weeks ago

Linking to #522