Repository for neat file name string patterns and tagger script snippets

Looks good.
What bugs do you still have? Any idea when you will fix them?

If you are talking about my script, I havenā€™t noticed any bugs.
But please report any and I will attempt to fix it.
I just wanted to create a script that people can customize to their liking at the very bottom.
Please note that all options should be set to 1 or 2, anything else will mess things up.

Edit: I added that into the script noop.

2nd Edit: I noticed a very minor error and I will fix it tomorrow.

You mean something like this:

$replace($rreplace(
   $if($eq(%albumartist%,Various Artists), [Various Artists],
	    $if($eq(%albumartist%,[unknown]), [Unknown],
          $left($rreplace($if2(%albumartistsort%,%artistsort%),; [^\)]+,), 60))
)
/
$if(%date%,[$left(%date%,4)] )$left($replace(%album%,/,), 70)
/
$if($gt(%totaldiscs%,1),$if(%discnumber%, $num(%discnumber%,2)-),)
$num(%tracknumber%,2). $left(%title%,120),[:?"_]+,),  , )

Hereā€™s the updated version. Fixed a very minor error.

$noop( *** DO NOT EDIT THE AREA BELOW | EDITABLE AREA WILL BE AT THE VERY BOTTOM *** )
			$set(MainFolder1,-= $upper($left(%albumartist%,1)) =-/)
			$set(MainFolder2,-= $upper($left(%albumartistsort%,1)) =-/)
			$set(MainFolder3,)
			$set(Artist1,$replace($rreplace(%albumartist%,[_:*?"<>|],-),?,)/)
			$set(Artist2,$replace($rreplace(%albumartistsort%,[_:*?"<>|],-),?,)/)
			$set(Album1,$replace($rreplace(%album%,[_:*?"<>|], -),?,)$if(%date%,$if(%album%, )[$left(%date%,4)])/)
			$set(Album2,$replace($rreplace(%album%,[_:*?"<>|], -),?,)/)
			$set(MultiDisc1,$if($gt(%totaldiscs%,1),Disc $num(%discnumber%,1)/)
			$set(MultiDisc2,)
			$set(PreTitle1,$replace($rreplace(%albumartist% - %album% -,[_:*?"<>|], -),?,))
			$set(PreTitle2,)
			$set(Track1, $num(%tracknumber%,2) - )
			$set(Track2, $num(%discnumber%,1)-$num(%tracknumber%,2) - ))
			$set(Title,$replace($rreplace(%title%,[_:*?"<>|],),?,))
$noop( *** DO NOT EDIT THE AREA ABOVE| EDITABLE AREA IS JUST BELOW *** )




$noop( *** The Following will use the example of artist: Amy Winehouse and album: Back to Black *** )
$noop( *** Default output: -=A =-/Amy Winehouse/Back to Black [2007]/Disc 1/Amy Winehouse - Back to Black - 01 - Rehab *** )
$noop( *** Change the NUMERICAL value ONLY! Example: %MainFolder1% would be changed to %MainFolder2% *** )
$noop( *** Only change the numerical value to either 1 or 2, anything else will mess things up. *** )
%MainFolder1%	$noop( OPTION 1 -= A=- | OPTION 2 -= W =- | OPTION 3 = No single character folder will be created. )
%Artist1%			$noop( OPTION 1 = Amy WineHouse| OPTION 2 = Winehouse, Amy )
%Album1%			$noop( OPTION 1 = Back to Black [2007] | OPTION 2 = Back to Black )
%MultiDisc1%		$noop( OPTION 1 = If album has more than 1 Disc, then add Disc folders | OPTION 2 = Do not sort by Disc, put all files into a single folder. )
%PreTitle1%		$noop( OPTION 1 = Show Artist and Album in the track title | OPTION 2 = Do not display Artist or Album)
%Track1%			$noop( OPTION 1 = Track Number: 01 | OPTION 2: Track Number: 1-01-> This is best if MultiDisc is set to 2, because you will have 2 track numbers as 01 - *track names*, etc. )
%Title%				$noop( NO OPTION - Just display the name of the track. )
3 Likes

How do you deal with naming when you have albums which are different editions/versions? For me the album names are the same, so it tried to put all the files into the same folder.

The way I do it here is to include the release date in the directory naming scheme.

Yeah I did that for a while, but wasnā€™t sure that would satisfy software that only read file name to determine versions. So I was thinking of baking everything in to the file name, but that gets ugly - especially if you start putting dates into it.

I use _releasecomments to get the disambiguation note. Also, I add Single and EP to the release folder if appropriate. That way the Hounds of Love album is in a folder called ā€œHounds of Loveā€ while the single is ā€œHounds of Love (Single)ā€.

1 Like

Piz:

I know this post is a couple years old, but I just recently copied and fairly significantly tweaked it to meet my needs. Something iā€™m struggling with is the above $set command. If Iā€™m understanding it correctly, isnā€™t that command supposed to be ā€œwritingā€ the value of _artist back to the actual artist tag of each track? I ask because I donā€™t see such an action happening when I save files with this file naming scripts running (using Picard 1.4.2). Same thing with:

I even tried changing both $set commands to string ā€œTESTā€ just to see what would happen. No change in the actual tags of the resulting files.

I think I must be missing something. Either the purpose of the command or something else. I assume you have your entire script in the File Naming script window; though maybe thatā€™s where Iā€™ve gone wrong and need to have all or some of the script in the Scripts option window.

Thoughts?

Thanks,
lahueneke

This is how script porn looks like for me. The details and how itā€™s set up reminded me of my own attempt of scripting except its complete, while mine is very much still a work in progress as I had no knowledge of programing when I began working on it.
The organization and ordnung is something my own ocd tendencies appreciate a lot, so Iā€™m gonna read and re-read your script because Iā€™m sure you have some great ways of doing it that I can incorporate in my own.
Thank you very much for sharing it!

Hereā€™s my naming script: https://pastebin.com/wWS3B3a1

Main features:

  • releases start with the originaldate unless itā€™s a live or or broadcast release whose name starts with a date, in which case no date, just the release name
  • ā€œTheā€ is moved to the end of the artist name, in a sort of ā€œliteā€ sort name
  • pulls in release comments, or custom local ā€œdisambigā€ tags when naming the release
  • albums go directly under the artist, but other release types get sorted into subdirectories
  • audiobooks are split off separately

Thanks all, especially those who added examples of the output: Seeing the scripting and output close together makes it much more understandable for my scripting illiteracy; I canā€™t do this sort of thing with my soldering iron! :wink:

That being said: If you are capable please add more, not because most scenarios arenā€™t already covered here, but seeing different variations, helps paint a more clear picture of how this all works.

I would say ā€œyou guys rockā€ but many of you pop and classical too!

2 Likes

Thank you so much for this, I loved the flexibility of your script. I googled for few patterns and I found yours to be the most :ok_hand: for my needs. If you ever plan to expand your script, I could suggest:

  • Ability to manipulate folder name ([Year] Album Name / Album Name [Year])
  • Not sure if possible, but add filetype to the name of the album folder, I have a mix of flac/mp3 and Iā€™m generally not bothered. Maybe one day, Iā€™d love to upgrade my most beloved albums to FLAC, but finding those would be a pain!
$noop( *** DO NOT EDIT THE AREA BELOW | EDITABLE AREA WILL BE AT THE VERY BOTTOM *** )
		$set(MainFolder1,-= $upper($left(%albumartist%,1)) =-/)
		$set(MainFolder2,-= $upper($left(%albumartistsort%,1)) =-/)
		$set(MainFolder3,)
		$set(Artist1,$replace($rreplace(%albumartist%,[_:*?"<>|],-),?,)/)
		$set(Artist2,$replace($rreplace(%albumartistsort%,[_:*?"<>|],-),?,)/)
		$set(Album1,$replace($rreplace(%album%,[_:*?"<>|], -),?,)$if(%date%,$if(%album%, )[$left(%date%,4)])/)
		$set(Album2,$replace($rreplace($if(%date%,$if(%album%, )[$left(%date%,4)] )%album%,[_:*?"<>|], -),?,)/)
		$set(Album3,$replace($rreplace(%album%,[_:*?"<>|], -),?,)/)
		$set(MultiDisc1,$if($gt(%totaldiscs%,1),Disc $num(%discnumber%,1)/)
		$set(MultiDisc2,)
		$set(PreTitle1,$replace($rreplace(%albumartist% - %album% -,[_:*?"<>|], -),?,))
		$set(PreTitle2,)
		$set(Track1, $num(%tracknumber%,2) - )
		$set(Track2, $num(%discnumber%,1)-$num(%tracknumber%,2) - ))
		$set(Title,$replace($rreplace(%title%,[_:*?"<>|],),?,))
$noop( *** DO NOT EDIT THE AREA ABOVE| EDITABLE AREA IS JUST BELOW *** )




$noop( *** The Following will use the example of artist: Amy Winehouse and album: Back to Black *** )
$noop( *** Default output: -=A =-/Amy Winehouse/Back to Black [2007]/Disc 1/Amy Winehouse - Back to Black - 01 - Rehab *** )
$noop( *** Change the NUMERICAL value ONLY! Example: %MainFolder1% would be changed to %MainFolder2% *** )
$noop( *** Only change the numerical value to either 1 or 2, anything else will mess things up. *** )
%MainFolder1%	$noop( OPTION 1 -= A=- | OPTION 2 -= W =- | OPTION 3 = No single character folder will be created. )
%Artist1%			$noop( OPTION 1 = Amy WineHouse| OPTION 2 = Winehouse, Amy )
%Album1%			$noop( OPTION 1 = Back to Black [2007] | OPTION 2= [2007] Back to Black  | OPTION 3 = Back to Black )
%MultiDisc1%		$noop( OPTION 1 = If album has more than 1 Disc, then add Disc folders | OPTION 2 = Do not sort by Disc, put all files into a single folder. )
%PreTitle1%		$noop( OPTION 1 = Show Artist and Album in the track title | OPTION 2 = Do not display Artist or Album)
%Track1%			$noop( OPTION 1 = Track Number: 01 | OPTION 2: Track Number: 1-01-> This is best if MultiDisc is set to 2, because you will have 2 track numbers as 01 - *track names*, etc. )
%Title%				$noop( NO OPTION - Just display the name of the track. )

Added the option to have year in front of album name.

1 Like

Added the ability to remove Various Artists. Check the very bottom on how to make this so. Should only be done on those albums only. Let me know what you think.

$noop( *** DO NOT EDIT THE AREA BELOW | EDITABLE AREA WILL BE AT THE VERY BOTTOM *** )
    $set(MainFolder1,-= $upper($left(%albumartist%,1)) =-/)
    $set(MainFolder2,-= $upper($left(%albumartistsort%,1)) =-/)
    $set(MainFolder3,)
    $set(MainFolder4,-= $upper($left(%artist%,1)) =-/)
    $set(MainFolder5,-= $upper($left(%artistsort%,1)) =-/)
    $set(Artist1,$replace($rreplace(%albumartist%,[_:*?"<>|],-),?,)/)
    $set(Artist2,$replace($rreplace(%albumartistsort%,[_:*?"<>|],-),?,)/)
    $set(Artist3,$replace($rreplace(%artist%,[_:*?"<>|],-),?,)/)
    $set(Artist4,$replace($rreplace(%artistsort%,[_:*?"<>|],-),?,)/)
    $set(Album1,$replace($rreplace(%album%,[_:*?"<>|], -),?,)$if(%date%,$if(%album%, )[$left(%date%,4)])/)
    $set(Album2,$replace($rreplace($if(%date%,$if(%album%, )[$left(%date%,4)] )%album%,[_:*?"<>|], -),?,)/)
    $set(Album3,$replace($rreplace(%album%,[_:*?"<>|], -),?,)/)
    $set(Album4,)
    $set(MultiDisc1,$if($gt(%totaldiscs%,1),Disc $num(%discnumber%,1)/)
    $set(MultiDisc2,)
    $set(PreTitle1,$replace($rreplace(%albumartist% - %album% -,[_:*?"<>|], -),?,))
    $set(PreTitle2,)
    $set(Track1, $num(%tracknumber%,2) - )
    $set(Track2, $num(%discnumber%,1)-$num(%tracknumber%,2) - ))
    $set(Track3,)
    $set(Title,$replace($rreplace(%title%,[_:*?"<>|],),?,))
$noop( *** DO NOT EDIT THE AREA ABOVE| EDITABLE AREA IS JUST BELOW *** )


$noop(
*** The Following will use the example of artist: Amy Winehouse and album: Back to Black *** 
*** Default output: -=A =-/Amy Winehouse/Back to Black [2007]/Disc 1/Amy Winehouse - Back to Black - 01 - Rehab ***
*** Change the NUMERICAL value ONLY! Example: %MainFolder1% would be changed to %MainFolder2% ***
*** Only change the numerical value to either 1 or 2, anything else will mess things up. *** )

%MainFolder1%    $noop( OPTION 1 -= A=- | OPTION 2 -= W =- | OPTION 3 = No single character folder will be created. )
%Artist1%            $noop( OPTION 1 = Amy WineHouse| OPTION 2 = Winehouse, Amy )
%Album1%            $noop( OPTION 1 = Back to Black [2007] | OPTION 2= [2007] Back to Black  | OPTION 3 = Back to Black )
%MultiDisc1%        $noop( OPTION 1 = If album has more than 1 Disc, then add Disc folders | OPTION 2 = Do not sort by Disc, put all files into a single folder. )
%PreTitle1%        $noop( OPTION 1 = Show Artist and Album in the track title | OPTION 2 = Do not display Artist or Album)
%Track1%            $noop( OPTION 1 = Track Number: 01 | OPTION 2: Track Number: 1-01-> This is best if MultiDisc is set to 2, because you will have 2 track numbers as 01 - *track names*, etc. )
%Title%            $noop( NO OPTION - Just display the name of the track.

Want to remove Various Artists - then do the following.
Should be done on those albums ONLY!
Change %MainFolder1% to either  3 or 4. Sorts by artist and not album artist.
Change %Artist1% to either 3 or 4. Sorts by artist and not album artist.
Change %PreTitle% to 2. Removes the artist name and album name from the track name.
Change %Track1% to 3. This removes the track number from the track name.)

@FragaGeddonā€¦ Any idea why the script you posted may be creating excessive dashes throughout the naming scripts? Iā€™m getting many replaced characters throughout the Artist, Album and Title.

i.e. ā€˜Eminem - Re -apse - Refi - - - 1-17 - Beaif.mp3ā€™

Seems to be replacing t, l, u, etc. New to this kind of scripting but familiar with coding in general and canā€™t get the finesse of this.

Seems like the forum messed it up a bit. So I put it in a text document and you can view it here: https://docs.google.com/document/d/1X_E02unQVq8n67zf5IhS8vhQkiA0ifi3xMxKJ30YUHk/edit?usp=sharing

Youā€™ll just be able to do a CTRL+A, then CTRL+C to copy it. When you paste it in to the program, the text may seem a little big, But once you click on Make it So! and go back in, the font size will be normal again.

3 Likes

Hello, new guy here.
I am really struggling with all this naming stuff. Can anyone help with a script that would produce the following results?
for a single artist:
/Phil Collins/Both Sides/Phil Collins - 01 - Both Sides of the Story.mp3
and for a various artist:
/Various Artists/The Best of 1980 - 1990, Volume 7/Black - 02 - Wonderful Life.mp3
/Various Artists/The Best of 1980 - 1990, Volume 7/Fine Young Cannibals - 03 - She Drives Me Crazy.mp3

After looking at the posts in this thread, I might like to try adding the CD number, so I guess it would like something like this:
/Various Artists/The Best of 1980 - 1990, Volume 7/CD1/Black - 02 - Wonderful Life.mp3

Any help would be greatly appreciated.

1 Like

Hi (thebradleys) - thanks for sharing your script. I am still a newbie to this tool. I used your script and tried to modify few things but wasnā€™t successful in getting what i was looking for. Hoping you can provide some suggestions.

I was trying to tag The Best of Eddie Cochran (2 CDs - 40 tracks) album. MB clustered it into 7 different albums. Not sure why would it do that although it exists in MB database (MBID: 35edcc27-a9c9-47bd-8abc-69df3f149fca ). Is it because of the scripting or some settings that is conflicting? Isnā€™t there a way to manually tag an entire album with MBID instead of a cluster, lookup, and scan approach?

I do not want to have multiple artists in the album name, so I have enabled standard artist names, and the script only uses album artist. Hope itā€™s not conflicting.

Have you enabled use release/tracks relationship for a better match?

I am not able to get genres in spite of enabling last.fm and MB Mood genre plugins to refresh the tags.

I am looking for is - Root folder / Album Artist (no featuring or multiple artists) / Album [Year] / Title. If more than one disc exists, then disc number followed by a track number 01-01 (02-01) in the title name would be helpful.

Thanks a lot!

Hi rdswift, I was hoping if you could help me modify the below script.

I would like to see: Root folder / Album Artist (no featuring or multiple artists) / Album [Release Year] / Title. If more than one disc exists, then the disc number followed by a track number 01-01 (02-01) in the title name would be helpful.