Author Topic: Is there a formula to replace invalid file characters?  (Read 3247 times)

tompeto

  • Full Member
  • ***
  • Posts: 151
I have an option to open a video of the song playing, giving a path which has in it the artist and title tags.
Whenever the artist or tile has an invalid file character like the "/" in AC/DC, the path for the file to open does not work.
I was thinking about making a virtual tag "<artist> - <title>".
How can I replace the invalid characters with another character?

Thanks

psychoadept

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 10691
You can use $Replace, but you'll have to do a separate $Replace for each character you want to change.  I know there was a request to make a regex version of $Replace, which would make it possible to do a variety of characters at once, but I don't think it was ever implemented.

http://musicbee.wikia.com/wiki/Functions
MusicBee Wiki
Use & improve MusicBee's documentation!

Latest beta patch (3.5)
(Unzip and overwrite existing program files)

tompeto

  • Full Member
  • ***
  • Posts: 151
Thank you, scampbll!

A function like the one you described would be ideal (replace a variety of characters at once) also for the web links.
Last Edit: April 09, 2014, 04:54:57 PM by tompeto

redwing

  • Guest
You could use folder name for artist tag instead of artist tag in your virtual tag since all invalid characters in artist name are stripped off when used in path.

psychoadept

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 10691
Good thinking, redwing!
MusicBee Wiki
Use & improve MusicBee's documentation!

Latest beta patch (3.5)
(Unzip and overwrite existing program files)

tompeto

  • Full Member
  • ***
  • Posts: 151
A way to replace more than one character (useful for weblinks and external connections to web sites or files):

$replace($replace(<artist>,/,),?,) - $replace($replace(<title>,/,),?,)

This will erase all "?" and "/" existent in the artist and title

$replace($replace($replace(<artist>,&,),/,),?,) - $replace($replace(($replace(<title>,&,),/,),?,)

This will erase all "?", "/" and "&" existent in the artist and title

etc