Skip to content

Conversation

jpauwels
Copy link

@jpauwels jpauwels commented May 3, 2025

Summary

  • This is a…
    • [] Bug fix
    • Feature addition
    • Refactoring
    • Minor / simple change (like a typo)
    • Other
  • Describe this change in 1-2 sentences:
    Allow up to 3 chars for Windows file name compatibility replacements.

Problem

Only allowing one-for-one replacements of problematic characters on Windows limits the flexibility in rewriting file names. Concretely, I'd like to replace a colon with a dash with additional whitespace, such that "Title: Subtitle" becomes "Title - Subtitle" instead of "Title- Subtitle".

Solution

Adapt the regex conformity check to allow up to three characters replacement for a single problematic character.

Action

Additional actions required:

  • Update Picard documentation (please include a reference to this PR)
  • Other (please specify below)

e.g. replace ":" with " -" such that "Title: Subtitle" becomes "Title - Subtitle"
@zas zas requested a review from phw May 3, 2025 16:59
Copy link
Member

@phw phw left a comment

Choose a reason for hiding this comment

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

This makes sense. But the patch alone will not fix this. The UI limits the maxLength for the inputs to 1 character only. Also the inputs themselves then should get a wider width.

If you want to give this a try you can update the ui/win_compat_dialog.ui file, which should be done using the Qt6 designer tool.

@phw
Copy link
Member

phw commented May 4, 2025

As this is a functional change that needs to be added to the changelog we also need a ticket on https://tickets.metabrainz.org/ before we can merge this.

@phw phw changed the title Allow up to 3 chars for Windows file name compatibility replacements PICARD-3084: Allow up to 3 chars for Windows file name compatibility replacements Jun 18, 2025
@phw
Copy link
Member

phw commented Jun 18, 2025

I added PICARD-3084 to track this. But the PR still needs more work before it is mergeable. The UI must be adjusted to allow more characters as well.

@rdswift
Copy link
Collaborator

rdswift commented Jun 21, 2025

I'm not against this change, but couldn't the desired behavior be produced using a tagger script? Something like:

$set(_new_title,$rreplace($replace(%title%,:, - ),\\s+, ))

and then use %_new_title% in the file naming script instead of %title%?

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

Successfully merging this pull request may close these issues.

3 participants