Use multiple $replace string

Hi Guys

Just joined and are very new to this scripting thing. And english arent my main, so I don't know what to google - I have tried.

I am generating a .nfo file with export.

  1. This is the line in the top:
    $filename($replace(%artist%, ,,) - $replace(%album%, ,).nfo,ansi)

The $replace 'space with _' is just fine. But I have multiple replacements I want to use (Trying to name after scene rules).

But how do I $replace with multiple string? Cause let's say that the album name is "Name & Name", then I want to place space with _ (Which I did), but I also want to place '&' with 'Og' etc etc.

Can someone please help me out, and explain it in details. :slight_smile:

You can include several pairs for replacement in one statement, e.g.
$replace(%artist%, ,_,&,Og,water,wine,evil,good)
you would have to use a separate function call if the field is a different one.

Wow, that was too simple. Thank you very much for a quick reply! :slight_smile:

Could you by any chance explain separate function call?

Oki, seems I have already run into trouble.

It worked fine when I added ,&,Og,

But when I added ,',, because I want to remove ' from the file name, it didnt work:

$filename($replace(%artist%, ,,&,Og,',,)-$replace(%album%, ,,&,Og,',,).nfo,ansi)

Any suggestions?

see the help?
https://docs.mp3tag.de/scripting

"... ' Outputs raw text without parsing. This will output the contained string and ignore all reserved characters. If you want to output this character, please use ''. ...."

I am sorry. I have looked in help all day. But me and code are not getting along. It's like reading chinese. :-/

Thank you again. Found out now.
$filename($replace(%artist%, ,,&,Og,'',,)-$replace(%album%, ,,&,Og,'',,).nfo,ansi)

Use the ' twice '' to get one '

If you are unsure about the special characters "Apostrophe" and "Double Quote", you may apply them as the result of the Mp3tag $char() function:
$char(32) gives the space character,
$char(34) gives the double quote character,
$char(38) gives the ampersand character,
$char(39) gives the single apostrophe character.
(see also: https://en.wikipedia.org/wiki/ASCII)

$filename($replace(%artist%, ,_,&,Og,'',,)-$replace(%album%, ,_,&,Og,'',,).nfo,ansi)

$filename($replace(%artist%'-'%album%'.nfo',$char(32),$char(95),$char(38),'Og',$char(39),$char(0)),ansi)

DD.20170622.1425.CEST

1 Like