Skip to content

Description tag in Rename#71

Merged
meesoft merged 3 commits intomainfrom
features/DescriptionRename
Feb 15, 2026
Merged

Description tag in Rename#71
meesoft merged 3 commits intomainfrom
features/DescriptionRename

Conversation

@meesoft
Copy link
Owner

@meesoft meesoft commented Feb 15, 2026

Summary by CodeRabbit

  • New Features

    • Added support for including photo descriptions in auto-generated filenames using the "|desc|" tag in naming masks.
    • Updated UI documentation to display the new description tag option alongside existing naming options.
  • Tests

    • Added test coverage for description tag functionality.

@meesoft meesoft marked this pull request as ready for review February 15, 2026 21:46
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 15, 2026

Warning

Rate limit exceeded

@meesoft has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 59 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

The PR adds support for exposing the Description metadata field through the file naming mask system by introducing EXIF query constants, implementing metadata retrieval logic with a new helper method, updating UI documentation for the new escape code, and adding corresponding unit tests.

Changes

Cohort / File(s) Summary
EXIF Query Constants
PhotoLocator/Metadata/ExifHandler.cs
Added two public constant strings (DescriptionQuery1 and DescriptionQuery2) exposing EXIF description tag paths for metadata retrieval.
Metadata Retrieval Logic
PhotoLocator/Metadata/MaskBasedNaming.cs
Introduced private AppendMetadata() helper method to fetch and append description metadata using fallback queries; added "desc" case in GetFileName() to support the new mask tag.
UI Documentation
PhotoLocator/RenameWindow.xaml
Updated Grid layout with new row, replaced escape-code description text from "*:4:4" reference to "desc Description tag", introduced additional escape-code documentation panels, and adjusted subsequent row indices.
Unit Tests
PhotoLocatorTest/Metadata/MaskBasedNamingTest.cs
Added GetFileNameWithMaskDescription() test method verifying that the "desc" mask tag correctly produces the expected filename output.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant RenameWindow as UI<br/>(RenameWindow)
    participant MaskBasedNaming as Naming Logic<br/>(MaskBasedNaming)
    participant ExifHandler as EXIF Handler<br/>(ExifHandler)
    participant Metadata as EXIF Data

    User->>RenameWindow: Enter filename mask with |desc|
    RenameWindow->>MaskBasedNaming: GetFileName(filename, mask)
    MaskBasedNaming->>MaskBasedNaming: Parse "desc" tag
    MaskBasedNaming->>MaskBasedNaming: AppendMetadata(sb, DescriptionQuery1, DescriptionQuery2)
    MaskBasedNaming->>ExifHandler: Get metadata using DescriptionQuery1
    ExifHandler->>Metadata: Query /app1/{ushort=0}/{ushort=270}
    alt Metadata found
        Metadata-->>ExifHandler: Return description value
        ExifHandler-->>MaskBasedNaming: Return description
    else Query1 failed
        MaskBasedNaming->>ExifHandler: Get metadata using DescriptionQuery2
        ExifHandler->>Metadata: Query /ifd/{ushort=270}
        Metadata-->>ExifHandler: Return description value
        ExifHandler-->>MaskBasedNaming: Return description
    end
    MaskBasedNaming->>MaskBasedNaming: Append description to result
    MaskBasedNaming-->>RenameWindow: Return processed filename
    RenameWindow-->>User: Display renamed file with description field
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • #63: Extends mask parsing in MaskBasedNaming.GetFileName() to support "*:start[:length]" syntax for substring extraction, directly complementary to this PR's addition of the "desc" mask tag.
  • #43: Modifies ExifHandler.cs to refactor ExifTool-related EXIF metadata extraction implementations, sharing the same file and metadata retrieval infrastructure.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Description tag in Rename' clearly and concisely summarizes the main change: adding support for a description tag in the file renaming feature, which is implemented across multiple files (ExifHandler, MaskBasedNaming, RenameWindow UI, and tests).
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch features/DescriptionRename

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@PhotoLocator/Metadata/MaskBasedNaming.cs`:
- Around line 122-127: AppendMetadata currently appends arbitrary free-text from
GetMetadata().GetQuery into result which can introduce characters invalid in
filenames; update AppendMetadata in MaskBasedNaming (and/or a helper used by it)
to sanitize the returned value from GetQuery by replacing or removing
Path.GetInvalidFileNameChars (and optionally Path.GetInvalidPathChars) and
trimming whitespace (e.g., replace each invalid char with '_' or remove), handle
null/empty values safely (skip or append empty) and then append the sanitized
string to result so filenames produced by MaskBasedNaming are valid.

In `@PhotoLocatorTest/Metadata/MaskBasedNamingTest.cs`:
- Around line 89-94: The test expects a filename containing backslashes which
are path separators and invalid in filenames; update AppendMetadata in
MaskBasedNaming (the metadata-handling routine used by _renamer.GetFileName and
referenced by GetFileNameWithMaskDescription) to sanitize metadata values by
removing or replacing Path.GetInvalidFileNameChars (and optionally
Path.GetInvalidPathChars) before inserting into the mask, or alternatively
reject/throw when metadata contains path separators; pick
sanitize-by-replacement (e.g., replace invalid chars with '_' or remove them)
and add a unit test change or new test documenting this sanitized behavior.
🧹 Nitpick comments (1)
PhotoLocator/Metadata/MaskBasedNaming.cs (1)

226-229: desc tag doesn't support the : format specifier unlike other tags.

Other tags use TagIs(tag, "desc", out iColon) pattern allowing format options (e.g., |desc:20| for truncation). The current tag == "desc" exact match is fine if no formatting is needed, but it's inconsistent with the other tag patterns. This is a minor design consideration for future extensibility.

@meesoft meesoft merged commit a2f62be into main Feb 15, 2026
5 checks passed
@meesoft meesoft deleted the features/DescriptionRename branch February 15, 2026 22:09
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.

1 participant