I am trying to use the following to get MP3tag to remove a character when creating a playlist.
%albumartist% - %year% - $replace(%album%,:,'-').m3u
However I am given the following message with the : highlighted...
Playlist - Filename:
Following characters are not allowed in file names:
Do you want it corrected automatically?
If I replace the : with an _, the string is accepted fine, and works as intended. This leads me to believe that if it would accept the string, the : would be replaced with a - as I intended. But, it won't allow me to put the : in the string.
Any hints at a work-around?
Are you sure that the incriminating character is the colon and that it appears in ALBUM?
To write filenames without problematic characters, see $validate()
... and for a simpler expression, you could leave out the apostrophes in the $replace() call.
Thank you for the reply.
Yes, unfortunately I have many album titles with colons in them (sad face).
It's quick and easy to reproduce, thankfully. I was hoping someone would recognize an error and let me know what I'm doing wrong.
I was thinking maybe I needed additional characters to delimit or avoid parsing or something similar. But, so far, still no-go.
Which function do you use to create that filename?
Have you tried $validate()?
Indeed, $validate() yields the same results.
Perhaps pics explain it better...
Replace the : with an _ and all is good and it works. But, I need it to eliminate :s not _s.
Oh, I see - this is just a stray error message.
If you use
%albumartist% - %year% - $validate(%album%,-).m3u
it should work the way you want it.
Apparently, the plausibility check for the filename only checks for the colon anywhere in the filename definition and does not detect that the colon is part of a scripting function.
See, whether the suggestion with $validate() works
Only if ALBUMARTIST does not contains something like AC/DC or A*Teens
I think that the resulting string would be checked again against the rules.
But here, the syntax check does not see that the colon is nothing evil but something inside a scripting function. The error message and the offer to rectify the alleged mistake will lead to a disabled replace function.
Thanks to @ ohrenkino.
Your solution works for my need(s).
Not sure about @ LyricsLover's comment. I dragged over an AC/DC album to see if it affected it, and it did not. It came out as AC-DC, which is what I want.
Any chance you (LyricsLover) have a good example routine I can try to illustrate what you're trying to say?
Then everything is fine. If AC-DC is the spelling you want, just ignore my comment.
Thinking about what LyricsLover said, I can see scenarios where I'd like a different character to replace specific invalid characters. It doesn't seem $validate will do that. Working with it a bit has shown $validate is a bit of an all-or-nothing approach in practice.
It seems if it were possible to over-ride the plausibility check, $replace would work the way I originally intended.
Perhaps the devs would consider a soft warning that could be implemented rather than a forced cancel or auto-correct which removes the 'invalid' character?
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.