my music file has tag
%artist% = George Michael
%title% = Everything She Wants (live)
my script in picard is to rename file based on the tags
%artist% - %title%
so i get the file name
George Michael - Everything She Wants (live)
but i want George Michael - Everything She Wants
i tried but it giave me error
%artist% - $strip($rreplace(%title%, \s+\(.*\)$, ))
thanks
1 Like
Try the replace call with $rreplace(%title%,\\s+\(.*\)$,)
.
Your script was looking for a space character followed by one or more of any whitespaces, so this was already at least two characters before the opening brace.
Also as a backslash is a special character in tagger script you should escape it as \\
.
1 Like
ok when i try this
%artist% - $strip($rreplace(%title%,\\s+\(.*\)$,)
i get this error
1:49: Unexpected character ','
I haven’t tested this, but try escaping the $ after the bracket, like:
%artist% - $strip($rreplace(%title%,\\s+\(.*\)\$,))
1 Like
@rdswift thank you
and thanks to @outsidecontext
it worked
2 Likes
oh no its truncating the title.
Ace of Base - Adventures in Paradise > Ace of Base - Adventures
What is the full path? Windows path length is by default limited to 259 characters.
You can enable long path support in Picard in Options > File naming > Compatibility. Just be aware that some software might have trouble handling those files with longer names. Depending on your version of Windows this includes the Explorer.
On current versions of Windows 10 and 11 you can also enable long path support system wide with some registry setting. I don’t have the details handy right now, though.
Alternative solution is of course to use a less deep folder structure and generally shorter names for folders and filenames.
See also the documentation:
https://picard-docs.musicbrainz.org/en/config/options_filerenaming_compat.html
1 Like
am on windows 10 and i have enabled the “long path”
but its not about the path issue, if i revert back renaming to
%artist% - %title%
George Michael - Careless Whisper.flac
George Michael - Cars and Trains.flac
George Michael - Cowboys and Angels.flac
George Michael - Crazy Man Dance.flac
George Michael - December Song (I Dreamed of Christmas).flac
but when i use this cript
%artist% - $strip($rreplace(%title%,\\s+\(.*\)\$,))
George Michael - Careless.flac
George Michael - Cars.flac
George Michael - Cowboys.flac
George Michael - Crazy.flac
George Michael - December.flac
so basicly script is removing everything after first white space.
Ah, yes. I see it now
The problem are the braces used in the expression. They are special characters in regular expression, and hence have to be escaped. But they also are special characters in tagger script, so this needs another level of escaping.
The regular expression we want is \s+\(.*\)$
. But when using this as part of tagger script the backslash, the braces and the dollar sign all are special characters there as well and need another escaping. So we actually get \\s+\\\(.*\\\)\$
.
Full script:
%artist% - $strip($rreplace(%title%,\\s+\\\(.*\\\)\$,))
In the original the braces had only a single backslash before them. So this gave you a regular expression of \s+(.*)$
, where the braces just form a matching group.
Yeah, combining two separate languages into one can lead to some real mess with escape characters.
3 Likes
perfect thank you @outsidecontext
2 Likes