Skip to content

Conversation

@mamk95
Copy link
Contributor

@mamk95 mamk95 commented Feb 17, 2025

This PR adds the ability to query by tag. You can use both tag ID or tag name/value as query, or a combination of ID and value. The query can be either a single string or a list of strings.

The Immich API requires a list of tag IDs. To be able to input a tag name, this suggested code first does a lookup of all tags using the Immich API, then translates the tag value to the tag ID.

Tested on Immich v1.126.1. Searching by tags was added in Immich v1.126.0, see this PR: immich-app/immich#15395

Example:

[
    {
        "name": "my album name",
        "query": {
            "tags": ["vacation1"]
        }
    },
    {
        "name": "my second album name",
        "query": {
            "tags": "545cf3a7-9f67-4028-9ed2-54bff6508052"
        }
    }
]

@kvalev
Copy link
Owner

kvalev commented Feb 17, 2025

Thanks for the PR! Can you also please update the version check here:

min_supported_version = Version(1, 113, 0)
assert immich_version >= min_supported_version, f"Minimum supported version is {min_supported_version}"

Either flat out require 1.126.0 or if you want to be fancy, you can make the version check dynamic based on whether the user has configured tags or not.

@mamk95
Copy link
Contributor Author

mamk95 commented Feb 18, 2025

Changes since original PR:

Thanks for making this project. I've used it a lot. Really appreciate it!

@kvalev kvalev changed the title Query by tag feat: query by tag Feb 19, 2025
@kvalev kvalev merged commit c9e6c2e into kvalev:main Feb 19, 2025
1 check failed
@kvalev
Copy link
Owner

kvalev commented Feb 19, 2025

Thanks! I created a new version - v0.2.0 which includes your changes, let me know if you have any problems with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants