Skip to content

#1584: file-name tokens for every stored metadata field - #1694

Merged
emmertex merged 1 commit into
stagingfrom
feat/naming-metadata-tokens
Nov 29, 2026
Merged

emmertex merged 1 commit into
stagingfrom
feat/naming-metadata-tokens

Conversation

@emmertex

Copy link
Copy Markdown
Owner

What

Issue #1584 asks for more metadata fields as tags in the Export file-name section (the reporter marks photos with a collection number in IPTC Job Identifier and a SKU in a spare field, and needs those markers in the exported file names for recipients who don't use a photo library).

The template system's rename::TOKENS list now covers every text and capture field the catalog already stores, beside the existing {title}/{creator}:

{caption} {headline} {category} {keywords} {copyright} {job_title} {location} {city} {state} {country} {serial} {alt_text} {extended_description} {description_writer} {shutter} {aperture} {focal}

One template language, everywhere it is shared: Export File name, Rename Photos, import renaming, import folder templates, Edit In. The Tags picker, photo.renameTokens, the photo.rename / photo.renamePreview / library.import command descriptions and the MCP schema all list the new tokens; each meaning is translated in all 17 fork catalogs (294 strings).

Choices worth noting:

  • {keywords} joins with spaces; {aperture} is the bare number (8, 2.8) — f/8 would lose its / in a name (f-8); {focal} is 24mm. Slideshow text overlays keep their own {caption}/{shutter}/{aperture}/{focal} forms — their extra callback still answers first there.
  • A field the photo doesn't have leaves an empty gap, exactly like the existing metadata tokens; a name that comes out empty keeps the original name.
  • The issue's literal ask (IPTC Job Identifier) is a field the catalog doesn't read or store; this PR sticks to tokens for stored fields (gap 36 narrows accordingly). Wiring up Iptc4xmpExt job id would be a separate metadata feature, and with {headline}/{category}/{alt_text}/{extended_description}/{description_writer} there are now five free marker fields to choose from.

Test

  • rename::tests::metadata_tokens_name_files_from_the_stored_fields: every new token expands from its field, technical forms (aperture number-only, focal 24mm), keywords join, empty-gap rule, and a full SKU-{keywords} name.
  • token_help_matches_the_implementation (existing) pins that every listed tag expands, the sample photo gives every tag a non-empty example, and the three command descriptions mention every token.
  • cargo xtask ci --quick: fmt, brand, docs, notes, i18n, windows, clippy, heif all green. The one failure is lcc-catalog tests_backup_prune::two_libraries_sharing_a_backup_folder… — the pre-existing red on origin/staging that intake PR Upstream intake 2026-11-29: 25 PRs #1681 fixes (fails on clean origin/staging without this diff; the ui-egui i18n gaps are the same story, 3 faces strings × 17 languages, also Upstream intake 2026-11-29: 25 PRs #1681). cargo xtask parity passes.

Manual: output/export-location — token list extended.

Closes #1584

The file-name templates shared by Export, Rename Photos and import renaming
knew {title} and {creator} only; a marker kept in another metadata field (a
collection number in Headline, a SKU in Alt Text, issue #1584) could not reach
the exported file's name. rename::TOKENS now covers every text and capture
field the catalog stores: {caption}, {headline}, {category}, {keywords}
(spaces), {copyright}, {job_title}, {location}, {city}, {state}, {country},
{serial}, {alt_text}, {extended_description}, {description_writer},
{shutter}, {aperture} (bare number: f/ would become - in a name) and {focal}
(24mm). Slideshow text overlays keep their own {caption}/{copyright}/
{shutter}/{aperture}/{focal} forms; their extra callback still answers first.
A field the photo doesn't have leaves an empty gap, as before.

The Tags picker, the photo.renameTokens help, the three command descriptions
and the MCP schema list the new tokens; each meaning is translated in every
fork catalog (294 strings).

Test: rename::tests::metadata_tokens_name_files_from_the_stored_fields expands
each new token, the technical forms and the empty-gap rule;
token_help_matches_the_implementation pins that the help, the sample photo and
the command descriptions agree with expand_tokens.

Manual: output/export-location (token list).

Co-Authored-By: ZCode
@emmertex

Copy link
Copy Markdown
Owner Author

PR steward (automated): reviewed and merging. Fast gate is green, all 17 new tokens have strings in every fork locale, and the manual, whats-new and changelog are updated. One small nit for later: {shutter} expands to 1/250, so it lands in file names as 1-250 once sanitised. The test comment in rename.rs says the technical tokens give names with no slash, which is only true for aperture/focal. Something like 1-250 or 250 might be worth emitting directly.

@emmertex
emmertex merged commit 2df71b1 into staging Nov 29, 2026
3 checks passed
@emmertex
emmertex deleted the feat/naming-metadata-tokens branch November 29, 2026 14:03
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.

Use more metadata fields for naming exported files

1 participant