Repository for neat file name string patterns and tagger script snippets

Cannot post full text here : picard.pts - BayFiles

But :wink:

The “MBP YA Magic-Script” is really a big deal for my need, I must update the script to work.
It work great now.
But I do a verry easy script, with addon Additional Artists Variables, the result is the same like MPB:

$if2(%_artists_album_primary_cred%,%artist%)
/
$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($if2(%date%,%originalyear%,%originaldate%),[$left($if2(%date%,%originalyear%,%originaldate%),4)] ,)
$if(%albumartist%,%album%,)
/
$if($gt(%totaldiscs%,1),%discnumber%,)$if($and(%albumartist%,%tracknumber%),$num(%tracknumber%,2) - ,)$if($if2(%_albumartists%,%artist%,),$if2(%_albumartists%,%artist%,) - ,)%title%

Updated both Scripts: 1. Saving from missing Files to an extra Folder is now working perfect. 2. Updated Normal Script saving to alphanumeric subfolders like A/, B/ and so on. Because anything without alphanumeric characters was just saved to the Folder #, i changed that part. If no alphanumeric album artist or artist name (in the case of various artists, album name) is found it just uses the first number, kanji, charakter or whatever it is and create that folder (like 1/ , 8/, ♂/). Just be shure that windows has other language packages installed and can write them. :slight_smile:

Hey there, because Music Brainz Picard Version 2.7 (beta) now supports more than one script i made use of it. I´m Tagging Collections seperately with Foobar2000 with the Tags Collection and Collectiontyp (just select all Files, go to properties, right click, add Tag. The good thing is the search engine in Foobar2000 to find anything for an collection) and than use these Tags in an second script with Music Brainz Picard.

I think that would work for Audio Books, DJ Mixes and the Like aswell because you use your personal Tags as base. :slight_smile:

It sorts out Dupes, Incompletes and even Missing Files that cant be found on MusicBrainz, so manually saving is possible.

Collection Script:

/Collections/


$get(collectiontyp)/
$get(collection)/



$get(_extension)/



$if($is_complete(),,

$if($lt($matchedtracks(),%_totalalbumtracks%),_Incomplete/,$if(%musicbrainz_albumid%,_Dupes/,_Missing/)))



$if(%musicbrainz_artistid%,

%originalyear% - $left(%album%,60)/
$if($gt(%totaldiscs%,1),CD$num(%discnumber%,2)-)$num(%tracknumber%,3) $left(%title%,60),

%date% - $left(%album%,60)/
$if($gt(%totaldiscs%,1),CD$num(%discnumber%,2)-)$num(%tracknumber%,3) $left(%title%,60))

My Normal Script looks like this and goes more into detail with Sorting, so feel free to combine them or so

MusicBrainz/



$get(_extension)/



$if($is_complete(),,

$if($lt($matchedtracks(),%_totalalbumtracks%),_Incomplete/,$if(%musicbrainz_albumid%,_Dupes/,_Missing/)))



$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),

$left($if2(%albumartist%, %artist%),50)/
$upper($firstalphachar($if2(%album%, %albumsort%),$if(%musicbrainz_albumid%,$left(%albumartist%,1),)))/
$left(%album%,60)/
$if($gt(%totaldiscs%,1),CD$num(%discnumber%,2)-)$num(%tracknumber%,3) $left(%title%,60),

$upper($firstalphachar($if2(%albumartist%, %artist%),$if(%musicbrainz_albumid%,$left(%albumartist%,1),)))/
$left($if2(%albumartist%, %artist%),60)/
$left(%album%,60)/
$if($gt(%totaldiscs%,1),CD$num(%discnumber%,2)-)$num(%tracknumber%,3) $left(%title%,60))

As a little example: I am tagging the “collectiontyp” Tag with the Tags Compilations, Discographies, Recordlabel, Soundtracks or Divers so adding something like Audiobooks or DJ Mixes as an collectiontyp would be possible.
For the Tag “collection” i am using something like Harry Potter (that would be collectiontyp Soundtracks) or Das Modul (that would be the collectiontyp Discographies) and so on.

1 Like

I tried adding the bitrate to the album directory name (to have multiple directories if i have different bitrate versions of the same album) but for some reason its completely ignoring it.
I tried adding to the Album directory extension

$if($eq(%_albumLevelTypeSeparation%,1),$if($eq(%_albumNameAtTypeSeparation%,1),%_albumForFilename%,)$if($eq(%_addBitRate%,1), %_fileVBRRate%%_fileCBRRate% %_bitRateType%)$upper( %_extension%)-%_fileCBRRate%%_fileVBRRate%)/

or to the _rootLevelTypeSeparation

$if($eq(%_rootLevelTypeSeparation%,1),$upper(%_extension%)-%_fileVBRRate%%_fileCBRRate%,)

but neither has any effect I can see.

I assume its a a stupid beginner’s error, but I cant seem to find it…

Thanks for any pointers

Edit: I found it, was indeed a stupid error.

tdiaz,
Thanks for the excellent script, it has vastly improved my organization of files.

Ignore below, I changed the tag in Picard and that sorted it. Other artists seem okay, was just that one

One preference I am struggling with is that I would like to remove the leading "The ", but then sort by first letter of firstname, so “The Alan Parsons Project” becomes “Alan Parsons Project, The”.
I have changed “orderTypeForArtist” but cannot end up with my preferred option.

I tried manipulating the code, but my programming skills are not up to the task.
Is this possible, or am I stuck with “Parsons, Alan, Project, The”.

Thanks again for your script, it really is a big aid to mere mortals like myself.

HI Tdiaz, You’re the author of the magic script right?
First what a brilliant script, thank you.
Theres just one issue for me and i’ve been scratching my head for an hour trying to make it work. When the item is a compilation, or soundtrack etc I dont want the alphabetical sorted subdirectories. e.g Various\Album_name (not Various\A\Album_name)
Is that possible?

Hi

I’m looking to try and use the ‘magic script’ to start the process of organising my music from multiple sources, HDD’s, USB’s etc. I’m planning to dump everything into a NAS, and i’ve been through some of the older posts for as much info as I can find regarding this.
Just wanted to confirm its still only possible to use this script if you build from the source code as per “Plugin Capabilities & a 'fix' (Q&D hack) for dealing with duplicate files in the album directory”.
Do I need to use a specific build version or is the current build ok?
Also, how difficult a process is this for a relatively newbie with Picard?

Thanks in advance

1 Like

This is a great question…I would like to know too. For me, I consider a song a duplicate as Album + MB ID (song id?) + Acoustic Fingerprint. I have songs that are on multiple albums that are the same but I do not consider them duplicates. Can Picard do this?

Whatever happened to the list of pre-made scripts that was here? This redirects to the current documentation (which is as it should be), but I couldn’t find the actual scripts there.

Update, I think I found it here: Scripts — MusicBrainz Picard v2.10 documentation
I was looking here: Scripting — MusicBrainz Picard v2.10 documentation

Hello, my last and all day script:

$if2(%artists_album_primary_std%,%_artists_album_primary_cred%,%albumartist%,%artist%,NO-ARTIST)
/
$upper([$if2($getmulti(%releasetype%,2),$getmulti(%releasetype%,1),$getmulti(%releasetype%,0),NO-RELEASETYPE)])
/
[$left($if2(%originaldate%,%originalyear%,%date%,0000),4)] $if2($if(%albumartist%,%album%,),NO-ALBUM)
/
$if($gt(%totaldiscs%,1),Disc%discnumber%/,)$if($and(%albumartist%,%tracknumber%),$num(%tracknumber%,2) - ,)$if($if2(%_artists_track_all_cred%,%_artists_track_primary_std%,%_albumartists%,%artist%,),$if2(%_artists_track_all_cred%,%_artists_track_primary_std%,%_albumartists%,%artist%,) - ,)%title%

Easy and quickly rename like this:
/Music/Arstist/[Releasetype]/[Year] Album Name/Disc1/track number - Singers - title.ext

Ex:

/Musique/Bruno Mars/[ALBUM]/[2010] Doo-Wops & Hooligans/01 - Bruno Mars - Grenade.mp3
/Musique/Depeche Mode/[COMPILATION]/[2006] The Complete Depeche Mode/Disc16/21 - Depeche Mode - Everything Counts (live).mp3
/Musique/Eminem/[MIXTAPE_STREET]/[2010] A Beautiful Mind/02 - Eminem feat. Nicki Minaj - Roman’s Revenge.mp3

2 Likes

(post deleted by author)

1 Like

@rdswift @Billy_Yank and at everyone LOL
OK…here goes…it look like rdswift and Billy_Yank’s scripts look like what I’m looking for my music. I have three folders: CD (all my music that I actually have CD’s converted), HD (all my digital hi-res music), and Music (all my digital MP3’s and iTunes non hi-res music). I want the script to keep the music in these three folders. I like how the scripts separates music in A,B,C folders for quicker search of artists by last name. I like the padded track and disc numbers by how many tracks per disc. For example, if the disc has over 100 tracks I would like it to show 001-100 (disc 1 track 100). I prefer my various artists albums to be under folder V and folder Various Artists. All this is the minimum I’m looking for…having dates included in the album folder is fine…I don’t mind the extra info. It looks like over the years changes have been made…so could you repost with your latest script(s)? The only thing I’m mainly concerned about is keeping my music in their main 3 folders (CD, HD, and Music).

On another note, I am curious about the language used for Picard. In high school and college, I have taken complete basic, basic, C, C++, Java, and an HTML course that covered HTML, DHTML, CSS, Javascript, Javabeans, etc. With all those classes, I never have come across all these /'s…LOL…is that something new now with the newer languages? I don’t like it…doesn’t look good and must be a pain in you know where for debugging.

Also, what program do you use now for writing these scripts? Still Notepad +?

My latest script is always available in my repo on GitHub. As you can see, it hasn’t been updated in quite a while.

There is a snippet in the repo showing how to automatically pad the disc and track numbers to match the number of discs or tracks available.

Picard itself is written in Python. The scripting language was initially based on that used in Foobar2000’s titleformat. For more information, have a look at the Scripting section of the Picard User Guide. The slashes in the file naming script are used to create subdirectories.

I actually do most of my script editing right in Picard so that syntax error checking and such is done in real-time. The added benefit to using Picard for file naming script development is that you can see example output immediately as well. If I need to use an external editor for major script work, I generally use VS Code which is what I use for most of my program code development.

4 Likes

The slashes are not part of the language. The filenaming scripts are building a file path, and slashes are directory separators. The result might be something like “Music/J/Michael Jackson/Thriller/04 Thriller.mp3”, the slashes indicating the directories. Oh, and slashes have been used for this purpose since somewhere in the 1970s, so they are not exactly a new thing :smiley:

1 Like

Would you mind posting your latest script(s)? Looks interesting and I might want to use it with my music too :slight_smile:

1 Like

@rdswift I have been trying some of the scripts in this thread and found yours to be the closest to what I would like, but I can’t seem to figure out how to change the artist folders to Firstname/The/A/An etc.. instead of Lastname, first. I have sorted my music like this for over 20 years and am not emotionally ready to deal with that jarring change. :wink:

Is there a setting I’m missing?

On another note, I was curious if it is possible to script translations of embedded ratings tags to a standard tag like POPM? Over the years I’ve embedded tags like fmps, banshee, amarok, quodlibet, and I’d like to standardize them if I could.

Thanks!

@akovia, if I understand your request correctly, I think it can be achieved by replaing the current line 417

$set(_nFilePath,%_nInitial%/%_nFAAPS%/%_nYear% %_nANT%/)

with

$set(_nFilePath,%_nInitial%/$swapprefix(%_nFAA%,A,An,The)/%_nYear% %_nANT%/)

Note that I haven’t tested this, so you may need to experiment a little.

Fantastic!
I guess I’m an outlier, but an option at the top might make a nice addition. I notice that the default included scripts appear to format in the same way for the names at least. Not sure about A/An/The though.

I really appreciate it!

Any thoughts on translating ratings?

That should be handled by the $swapprefix() command.

No, because I wasn’t sure I understand what you’re trying to do. Can you provide more of an explanation?

No, because I wasn’t sure I understand what you’re trying to do. Can you provide more of an explanation?

Yes, I apologize for not explaining better.

I have used different music players over the years and when possible I had them embed my ratings into the tags so I could keep the reference in hopes that another player might be able to read them in the future. (Never seems to be the case of course)

Out of all the ratings that have been used over the years, it seems to me that POPM is the most “Popular”. (pun intended) I think mostly because of the email reference that allows multiple users to share the same library with different ratings. Quodlibet adopted this strategy as well, but the player itself is not well known.

So I’m trying to script a way to identify the various tags I’ve used in the past, and translate them to the POPM format. Mostly reading from a 0-100 scale to the 1-255 scale of POPM. Adding the email and play count portion of POPM as well.

POPM = email@somehwere.com|1-255|0

I wrote about this five years ago here and it looked like it might get some love, but just kinda died.

Might not be a good fit here either, but never know until you ask.

Thanks again!

Edit: I should state that right now I’m only interested in mp3 tags. I realize everything gets more complicated the more formats you add.

Thanks for the extra explanation. I’m not really a guru regarding mapping of tags and how they are stored in the files (far from it actually), so I don’t think I can help you on this one. Sorry.