Replacing strings in various ways?

Tags: #<Tag:0x00007f4bf7ca0ea0> #<Tag:0x00007f4bf7ca0a40>

I currently have an album artist named The Funk Parlour. I would like to have the directory saved as Funk Parlour, The instead, this my current naming script:

$set(album,$strip($rreplace(%album%,["*:<>?/|],)))
$set(albumartist,$rreplace(%albumartist%,["*:<>?|],))
$set(artist,$rreplace(%artist%,["*:<>?|],))
$set(date,$left(%date%,4))
$set(title,$rreplace(%title%,["*:<>?|],))
$if2(%albumartist%,%artist%)/
$if($and(%albumartist%,%date%),%album% \(%date%\)/,)
$if($and(%albumartist%,%tracknumber%),$num(%tracknumber%,2). ,)%title%

While on the rename topic, I have another question. Sometimes the album artist name ends with a . dot, which is violation for Windows naming convention. Picard replaces the ending dot with an underscore, I would like to have it removed.

I currently use:

$set(albumartist,$rreplace(%albumartist%,["*:<>?|],))

I’m thinking to use, but this will also delete the round brackets:

$set(albumartist,$rreplace(%albumartist%,["*:<>?|\(.\$\)],))

Edit, this works as expected:

$set(albumartist,$rreplace(%albumartist%,["*:<>?|.\$],))

I’m also trying to replace without success the / with nothing, into a string like Money / Get My Love / Break Mambo:

$set(album,$strip($rreplace(%album%,["*:<>?/|],)))

Thank you for your help.

This works removing the dot at end:

$set(albumartist,$rreplace(%albumartist%,["*:<>?|.\$],))

@outsidecontext Phil or anyone, if you have any tips for the rest of issues, please let me know. Thank you.

Two options:

  1. Use %albumartistsort% instead. For “The Funk Parlour” this will be “Funk Parlour, The”. but it also means it will switch person names to family name first, e.g. “Jackson, Michael” instead of “Michael Jackson”. If you want this, this solution works best

  2. If you only care about the prefix moved to the end, use the $swapprefix function:

    $swapprefix(%albumartist%)
    

    See also https://picard-docs.musicbrainz.org/en/functions/func_swapprefix.html

This doesn’t exactly do what you want. It will match a dot at any position, and it will match a literal dollar sign. Try this instead:

$rreplace(%albumartist%,\(["*:<>?|]|\\.\$\),)

For clarity, the actual regular expression here (without the additional escaping required for tagger script) is (["*:<>?|]|\.$)

2 Likes