Repository for neat file name string patterns and tagger script snippets

Hi
I would like to repay you all for the help I got in the forum and share with my script. I apologize for the level of English. It is very weak, so I explained the description using a translator.

To keep everything working properly, additional plugins will be required:


Additional Artists Variables, link: picard-plugins/plugins/additional_artists_variables at 2.0_RDS_Plugins · rdswift/picard-plugins · GitHub

Also im using:
Feat. Artists in Titles
Standardise Feat.

File Naming script:

$swapprefix($if2(%_artists_album_primary_std%,%artist%),The,Die,Le)
/$replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($swapprefix($if2(%albumartist%,%artist%),The,Die,Le),",''), meets , & ), X , & ), × , & ),; , & ), x , & ), | , & ), • , & ), ⋅ , & ), and , & ),+,&), with , & ), _ , & ), vs , & ), vs. , & ) - $replace($replace($truncate(%album%,100),",''),:,-)
$if($gt(%totaldiscs%,1), %totaldiscs%CD)
$if($in(%media%,Vinyl), [Vinyl],)
$if($in(%media%,Cassette), [Cassette],)
$if($eq(%releasestatus%,promotion), [Promo],)
$if($eq(%releasestatus%,bootleg), [Bootleg],)
$if($ne_all(%catalognumber%,none,[none]),$if(%catalognumber%, $upper([$replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($rsearch(%catalognumber%,\(.+?\)\(?:; |\$\)+),_,),⋅,),/,),:,),*,),?,),",),<,),>,),|,), ,)])))
$if(%date%, [%date%],)
$if($eq(%releasetype%,album), [Album],
$if($eq(%releasetype%,single), [Single],
$if($eq(%releasetype%,ep), [EP],
$if($eq(%releasetype%,broadcast), [FM],
$if($eq(%releasetype%,other), [Other],
$if($inmulti(%releasetype%,dj-mix), [DJ Mix],
$if($inmulti(%releasetype%,remix), [Remix],
$if($inmulti(%releasetype%,soundtrack), [OST],
$if($inmulti(%releasetype%,live), [Live],
$if($inmulti(%releasetype%,mixtape/street), [Mixtape],
$if($inmulti(%releasetype%,compilation), [Compilation],)))))))))))
$if($ne(%_extension%,mp3), $upper(%_extension%))
$if($gt(%_bits_per_sample%,16), %_bits_per_sample%bit $div(%_sample_rate%,1000)kHz)
/$if($gt(%totaldiscs%,1),CD$num(%discnumber%,2)$if(%discsubtitle%, - %discsubtitle%,))
/$if($in(%media%,Vinyl),%_musicbrainz_tracknumber%,$num(%tracknumber%,2)). $if(%_multiartist%,%artist% - ,)$truncate(%title%,70)

Single artist releases:
obraz
Multi artist releases (Compilations, Soundtracks, DJ-Mixes etc)::
obraz
obraz

Below is an explanation of what each command does (for beginners with Picard):

$swapprefix($if2(%_artists_album_primary_std%,%artist%),The,Die,Le)

Creates the main folder with the first artist from the %artists% (it works only withi plugin: Additional Artists Variables). Additionally, moves The, Die, Le to the end of the artist name:
obraz
obraz

/$replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($swapprefix($if2(%albumartist%,%artist%),The,Die,Le), meets , & ), × , & ),; , & ), x , & ), | , & ), • , & ), ⋅ , & ), and , & ),+,&), with , & ), _ , & ), vs , & ), vs. , & ) - $replace($truncate(%album%,100),:,-)

Creates a subfolder with the albumartist or artist (The, Die, Le at the end of the name) and the name of the album. Replaces only at the artist name: “and”, “+”, “with”, “/”, “vs”, “vs.” and more with “&” (because I like to have order and sorted alphabetically albums). Album names have a limit of 100 characters, in addition in their names “:” it is converted to “-”.
obraz

$if($gt(%totaldiscs%,1), %totaldiscs%CD

In multi-CD editions, it adds a CD prefix with the disc number, e.g. 2CD, 10CD:
obraz

$if($in(%media%,Vinyl), [Vinyl],)
$if($in(%media%,Cassette), [Cassette],)

For vinyl (vinyl, 7", 10", 12") and cassettes adds [Vinyl] and [Cassette]:
obraz

$if($eq(%releasestatus%,promotion), [Promo])
$if($eq(%releasestatus%,bootleg), [Bootleg])

[Promo] and [Bootleg]:
obraz

$if($ne_all(%catalognumber%,none,[none]),$if(%catalognumber%, $upper([$replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($rsearch(%catalognumber%,\(.+?\)\(?:; |\$\)+),_,),⋅,),/,),:,),*,),?,),",),<,),>,),|,), ,)])))

If it occurs it adds [catalognumber] (only the first one) with upper case and omission: none, [none]. Also deletes from catalognumber: _, ⋅, /, :, *, ?, ", <, >, | and free spaces:

obraz
Big THANKS to @Harakku for his great job.

$if(%date%, [%date%],)

Adds four digit year: [2019]

$if($eq(%releasetype%,album), [Album],
$if($eq(%releasetype%,single), [Single],
$if($eq(%releasetype%,ep), [EP],
$if($eq(%releasetype%,broadcast), [FM],
$if($eq(%releasetype%,other), [Other],
$if($inmulti(%releasetype%,dj-mix), [DJ Mix],
$if($inmulti(%releasetype%,remix), [Remix],
$if($inmulti(%releasetype%,soundtrack), [OST],
$if($inmulti(%releasetype%,live), [Live],
$if($inmulti(%releasetype%,mixtape/street), [Mixtape],
$if($inmulti(%releasetype%,compilation), [Compilation],)))))))))))

Adds [Album],[Single],[EP],[FM],[Other],[DJ Mix],[Remix],[OST],[Live],[Mixtape],[Compilation] depending on the release.

$if($ne(%_extension%,mp3), $upper(%_extension%))

Adds after releasetype, file extension like FLAC, WAV, OGG excluding mp3:
obraz

$if($gt(%_bits_per_sample%,16), %_bits_per_sample%bit,)
$if($gt(%_sample_rate%,48000), $div(%_sample_rate%,1000)kHz,)

or

$if($gt(%_bits_per_sample%,16), %_bits_per_sample%bit $div(%_sample_rate%,1000)kHz)

For files with bits per sample greater than 16 and sample rate greater than 48kHz adds values with suffix bit and kHz e.g. 24bit 96kHz:
obraz

/$if($gt(%totaldiscs%,1),CD$num(%discnumber%,2)$if(%discsubtitle%, - %discsubtitle%,))

For multi-disc releases, it creates subfolders with breaks into discs and disc subtitles (if they occur):
obraz

/$if($in(%media%,Vinyl),%_musicbrainz_tracknumber%,$num(%tracknumber%,2)). $if(%_multiartist%,%artist% - ,)$truncate(%title%,70)

creates a file name in the following format: two-digit song number for CDs and A1, A2 for Vinyls, artist (for albums with multiple artists) and song title:
Single
obraz
Multiple
obraz
Vinyl
obraz

I also use tagger scripts:

$set(date,$left(%date%,4))

Changin full date into four digit year:

$set(album,$rreplace(%album%,\\s\\\(feat. [^\)]+\\\),))

Remove “feat.” from album titles.

$set(album,$if(%_releasecomment%,%album% \($title(%_releasecomment%)\),%album%))

Add disambiguation into the album tag (first character in every word capitalized). Useful when we have several releases of the same album and want to somehow distinguish them:



obraz

My script is 99% complete (i think so). Only one thing left to do / improve. Link to the thread:

if anyone knows the solution, please let them write. I’m counting on you :wink: @Harakku did it. Thank you.

Last thing, if someone would like to have additional columns in the main window, like this:


check this topic:

I apologize for the lengthy reply and too many screenshots, but it should help beginners create them own dream script. Thank you once again for all your help.

EDIT1: added some little modifications and track numbers for Vinyl (A1, A2, B1…). More info above.

14 Likes