Proper Title Case Script and Last Name-First Name Switch

Tags: #<Tag:0x00007f756c2d3848> #<Tag:0x00007f756c2d3758>

Hi All!

Does anybody have a working script for a proper title case? (Capitalizing everything close-class words – the, a, an, and, and so on?) I found a Mass Tagger Script, but that obviously doesn’t work in Picard and my own little script is insufficient.

I’m also looking for a script to stop Picard from reversing first and last names in the sort fields.

Mass Tagger Script:

Ï∞XüzíHæ∞RÑ[ÎK&rˆH3äü@†flˇ±Wfle~TITLE
$caps2(%title%)&rˆH3äü@†flˇ±Wfle~lTITLE
$if($strchr(%title%, ),$replace(%title%,’ ‘,’ ‘,’ By A ‘,’ by a ‘,’ For A ‘,’ for a ‘,’ In A ‘,’ in a ‘,’ Of A ‘,’ of a ‘,’ On A ‘,’ on a ‘,’ A ‘,’ a ‘,’ To An ‘,’ to an ‘,’ An ‘,’ an ‘,’ And The ‘,’ and the ‘,’ And ‘,’ and ‘,’ As ‘,’ as ‘,’ At The ‘,’ at the ‘,’ At ‘,’ at ‘,’ By The ‘,’ by the ‘,’ By ‘,’ by ‘,’ But ‘,’ but ‘,’ For The ‘,’ for the ‘,’ For ‘,’ for ‘,’ From A ‘,’ from a ‘,’ From The ‘,’ from the ‘,’ From ‘,’ from ‘,’ In A ‘,’ in a ‘,’ In An ‘,’ in an ‘,’ In The ‘,’ in the ‘,’ In ‘,’ in ‘,’ Into ‘,’ into ‘,’ Nor ‘,’ nor ‘,’ Out Of A ‘,’ out of a ‘,’ Out Of The ‘,’ out of the ‘,’ Out Of ‘,’ out of ‘,’ Of A ‘,’ of a ‘,’ Of The ‘,’ of the ‘,’ Of ‘,’ of ‘,’ On The ‘,’ on the ‘,’ On ‘,’ on ‘,’ Onto ‘,’ onto ‘,’ Or The ‘,’ or the ‘,’ Or ‘,’ or ‘,’ To The ‘,’ to the ‘,’ With The ‘,’ with the ‘,’ The ‘,’ the ‘,’ To ‘,’ to ‘,’ With ‘,’ with ‘),%title%)&rˆH3äü@†flˇ±Wfle~≠TITLE
$if($strchr(%title%, ),$left(%title%,$sub($len(%title%),3))$replace($right(%title%,3),’ by’,’ By’,’ in’,’ In’,’ of’,’ Of’,’ on’,’ On’,’ or’,’ Or’,’ to’,’ To’),%title%)&rˆH3äü@†flˇ±Wfle~ÅTITLE
$if($strchr(%title%, ),$left(%title%,$sub($len(%title%),4))$replace($right(%title%,4),’ for’,’ For’,’ out’,’ Out’),%title%)&rˆH3äü@†flˇ±Wfle~ïTITLE
$if($strchr(%title%, ),$left(%title%,$sub($len(%title%),5))$replace($right(%title%,5),’ into’,’ Into’,’ from’,’ From’,’ with’,’ With’),%title%)&rˆH3äü@†flˇ±Wfle~ÅTITLE
$if($strchr(%title%, ),$replace(%title%,‘Best of’,‘Best Of’,’- the ‘,’- The ‘,’: the ‘,’: The ‘,’& the ‘,’& The ‘),%title%)&rˆH3äü@†flˇ±Wfle~ALBUM
$caps2(%album%)&rˆH3äü@†flˇ±Wfle~lALBUM
$if($strchr(%album%, ),$replace(%album%,’ ‘,’ ‘,’ By A ‘,’ by a ‘,’ For A ‘,’ for a ‘,’ In A ‘,’ in a ‘,’ Of A ‘,’ of a ‘,’ On A ‘,’ on a ‘,’ A ‘,’ a ‘,’ To An ‘,’ to an ‘,’ An ‘,’ an ‘,’ And The ‘,’ and the ‘,’ And ‘,’ and ‘,’ As ‘,’ as ‘,’ At The ‘,’ at the ‘,’ At ‘,’ at ‘,’ By The ‘,’ by the ‘,’ By ‘,’ by ‘,’ But ‘,’ but ‘,’ For The ‘,’ for the ‘,’ For ‘,’ for ‘,’ From A ‘,’ from a ‘,’ From The ‘,’ from the ‘,’ From ‘,’ from ‘,’ In A ‘,’ in a ‘,’ In An ‘,’ in an ‘,’ In The ‘,’ in the ‘,’ In ‘,’ in ‘,’ Into ‘,’ into ‘,’ Nor ‘,’ nor ‘,’ Out Of A ‘,’ out of a ‘,’ Out Of The ‘,’ out of the ‘,’ Out Of ‘,’ out of ‘,’ Of A ‘,’ of a ‘,’ Of The ‘,’ of the ‘,’ Of ‘,’ of ‘,’ On The ‘,’ on the ‘,’ On ‘,’ on ‘,’ Onto ‘,’ onto ‘,’ Or The ‘,’ or the ‘,’ Or ‘,’ or ‘,’ To The ‘,’ to the ‘,’ With The ‘,’ with the ‘,’ The ‘,’ the ‘,’ To ‘,’ to ‘,’ With ‘,’ with ‘),%album%)&rˆH3äü@†flˇ±Wfle~≠ALBUM
$if($strchr(%album%, ),$left(%album%,$sub($len(%album%),3))$replace($right(%album%,3),’ by’,’ By’,’ in’,’ In’,’ of’,’ Of’,’ on’,’ On’,’ or’,’ Or’,’ to’,’ To’),%album%)&rˆH3äü@†flˇ±Wfle~ÅALBUM
$if($strchr(%album%, ),$left(%album%,$sub($len(%album%),4))$replace($right(%album%,4),’ for’,’ For’,’ out’,’ Out’),%album%)&rˆH3äü@†flˇ±Wfle~ïALBUM
$if($strchr(%album%, ),$left(%album%,$sub($len(%album%),5))$replace($right(%album%,5),’ into’,’ Into’,’ from’,’ From’,’ with’,’ With’),%album%)&rˆH3äü@†flˇ±Wfle~ÅALBUM
$if($strchr(%album%, ),$replace(%album%,‘Best of’,‘Best Of’,’- the ‘,’- The ‘,’: the ‘,’: The ‘,’& the ‘,’& The '),%album%)

Summary

This text will be hidden

My own Script: (that I can’t get to work anymore and that would also turn first and last words to lowercase)

$set(title,$replace(%title%,A|An|And|As|At|But|By|En|For|If|In|Of|On|Or|The|To|Via|Vs.,a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|via|vs.))

Any help would be appreciated!

I can’t read that script as it is too complex, but I have two thoughts:

One: Isn’t there a plugin that puts All The Caps Back In To Place? Have a look at the Plugin “Smart Title Case” or “Title Case” as the description may fit your needs. It would be a common request as the Capitalisation Rules Here at MB are a Bit Weird.

https://picard.musicbrainz.org/plugins/

Check on the version 2 section and scroll down…

Two: If you don’t like the Sort Order as it is set in the MB database, why not just copy the Artist Name into the Sort Order tag on your system? It is not Picard that is “reversing first and last names” - Picard is asking the MusicBrainz database for that Sort Order.

Thanks for the answer.

This Is Exactly Not What I Want – But this Would Be. That’s what I meant by proper. Everything capitalised excapt short close-class words (as per Chicaco Style etc.). Smart Title Case only stops things like USA turning into Usa so my idea was running the Title Case Plugin and then running a script that turns all these short words lowercase. This was my Idea:

$set(title,$replace(%title%,’a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|via|vs.', a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|via|vs.))

But it somehow doesn’t work.

And thanks for the sort order tip, I thought there was a way of automating this, but I guess your way is acceptable.

You can automate it. Just use a script like:

$set(artistsort,%artist%)
$set(albumartistsort,%albumartis%)

Or you could opt to not save the sort name tags at all:

$delete(artistsort)
$delete(albumartistsort)

In absence of sort tags players will just use the normal names for sorting.

2 Likes