Repository navigation
feat: date-from-ocr workflow, assets ocr, structured search filters - #46
Merged
Merged
Conversation
Add `client-workflow date-from-ocr`, which sets an asset's capture year from a year Immich's OCR found in the image (e.g. on scanned prints): - sources: --album-id/--album-name, asset IDs or Immich web links (positional or --ids-file), or --all (whole library, pre-filtered server-side by one OCR search per year, then an OCR check of each hit) - report by default (with web links, --json); --yes applies only unambiguous single-asset changes (YYYY-06-01, tag immich-admin-cli/date-from-ocr) and is refused with --all - --interactive (terminal only) reviews hits grouped by album: [s]kip [t]his [a]lbum [n]ext album [y]ear [o]pen [q]uit; [a]lbum lists every album asset with old -> new date and asks again, tagging propagated assets immich-admin-cli/date-from-ocr-album Also: - new `assets ocr` command (getAssetOcr) - every command that takes asset IDs now also accepts Immich asset links - `search metadata` now uses only the structured filter/orderBy shape. The deprecated flat fields made every filtered search fail with 400 on current servers, because --order sent orderBy alongside them. Trashed assets stay excluded (trashedAt eq null), --taken-after/--taken-before now actually filter, and --type/--order are validated - SearchPager never sends the deprecated page field with the new shape Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preview binaries (commit
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New:
client-workflow date-from-ocr. It sets an asset's capture year from a year that Immich's OCR found in the image, typically on scanned or re-photographed prints.--album-id/--album-name--ids-file--allfor the whole library: one server-side OCR search per year, then an OCR check of each hit. Takes about 22 s on a real library.--json. Each hit gets a status:change,matchesorambiguous(several years).--yesapplies only unambiguous single-asset changes. The date becomesYYYY-06-01 00:00and the asset is taggedimmich-admin-cli/date-from-ocr.--all: library-wide hits contain many numbers that are not dates, such as "seit 1938" or "2000 qm".--interactive(needs a terminal) groups the hits by album and offers[s]kip [t]his [a]lbum [n]ext album [y]ear [o]pen [q]uit.[a]lbumlists every asset in the album with its old and new date, then asks again (default No). Assets changed this way are taggedimmich-admin-cli/date-from-ocr-album.--all --interactiveskips assets whose year already matches.Also in this PR
assets ocrcommand (getAssetOcr).…/people/<id>/photos/<assetId>?….search metadata. On current servers every filtered search failed with 400, because--ordersent the neworderByalongside the deprecated flat fields and the server rejects that mix. The command now uses only the structuredfilter/orderByshape:trashedAt: {eq: null}, which the generated type cannot express, so it is patched into the JSON.--taken-after/--taken-beforenow actually filter; before, they were silently ignored.--typeand--orderare validated against their allowed values.SearchPagerno longer sends the deprecatedpagefield together with the new shape.Test plan
go generate ./... && go build ./... && go test ./... && go vet ./... && go fix ./...search metadatafilters, trash exclusion and cursor paging.--allreport: 2,069 candidates in 22 s.--all --yesis refused.--interactiveexercised by a human in a real terminal (in progress by the author).Not in this PR: the workflows
find-no-thumbhash,find-heic-tile-defect,FetchAlbumAssetsandFetchTagAssetsstill use the deprecated flat search fields. They still work, but should move tofilterin a follow-up.🤖 Generated with Claude Code