Repository for neat file name string patterns and tagger script snippets

This is based on a subset of my naming script, but I think it will do most of what you want. I believe that all of the elements are there, but they may be in a slightly different order so you might have to move the various bits around. It processes soundtracks, singles, various artists compilations and “normal” albums differently, and saves them to a slightly different structure as:

Process as Soundtrack
    Format: /[Soundtrack]/[year] Album/Disc-Track Title [Artist]

Process as Single
    Formats: /~ A ~/Album Artist/[~Singles~]/[year] Title [feat.]

Process as Standard
    Formats: /~ A ~/Album Artist/[year] Album/Disc-Track Title [feat.]
             /~ # ~/Album Artist/[year] Album/Disc-Track Title [feat.]
             /[Various Artists]/[year] Album/Disc-Track Title [Artist]
             /[Unknown Artists]/[year] Album/Disc-Track Title [Artist]

Note that one of the elements relies on a plugin that I wrote which is not (yet) in Picard’s list of standard plugins. It is called Additional Artists Variables and is available for download from my GitHub repository. There is also a User Guide available, which includes some examples of how the plugin could be used.

Here’s the script. Note that I haven’t tested this, so it might need some tweaking to do exactly what you’re after:

$noop(
#######################################################################
#
#  Picard File Naming Script for krishk                      2019-02-14
#  Prepared by: rdswift
#
#  License: GPLv3.0
#
#######################################################################
#
#  This script relies on inputs provided by the "Additional Artists
#  Variables" plugin.  This plugin is freely available for use under
#  GPL-2.0 or later, and the latest version can be downloaded from the
#  author's repository at:
#
#  https://github.com/rdswift/picard-plugins/raw/2.0_RDS_Plugins/plugins/additional_artists_variables/additional_artists_variables.zip
#
#######################################################################
)

$noop(
#######################################################################
#
#  Constants
#
#######################################################################
)
$set(_cUnknownArtistID,125ec42a-7229-4250-afc5-e057484327fe)
$set(_cVariousArtistID,89ad4ac3-39f7-470e-963a-56509c546377)
$set(_cUnknownArtist,[Unknown Artist])
$set(_cVariousArtist,[Various Artists])
$set(_cUnknownAlbum,[Unknown Album])
$set(_cNoTitle,[Unknown Title])
$set(_cSingles,[~Singles~])
$set(_aTitleMaxLength,65)
$set(_tTitleMaxLength,65)
$set(_tFilenameMaxLength,120)


$noop(
#######################################################################
#
#  Defaults if "Additional Artists Variables" plugin not loaded or metadata is missing
#
#######################################################################
)
$set(_nFAA,$if2(%_artists_album_all_std%,%albumartist%,%_cUnknownArtist%))
$set(_nPAA,$if2(%_artists_album_primary_std%,%albumartist%,%_cUnknownArtist%))
$set(_nFAAS,$if2(%_artists_album_all_sort%,%albumartistsort%,%_cUnknownArtist%))
$set(_nPAAS,$if2(%_artists_album_primary_sort%,%albumartistsort%,%_cUnknownArtist%))
$set(_nFAAPS,$if2(%_artists_album_all_sort_primary%,%albumartistsort%,%_cUnknownArtist%))

$set(_nPTA,$if2(%_artists_track_primary_cred%,%artist%,%_cUnknownArtist%))
$set(_nATA,%_artists_track_additional_cred%)
$set(_nFTA,$if2(%_artists_track_all_cred%,%artist%,%_cUnknownArtist%))

$set(_nAN,$if2(%album%,%_cUnknownAlbum%))
$set(_nANT,$if2(%album%,%_cUnknownAlbum%))

$set(_nTN,$if2(%title%,%_cNoTitle%))
$set(_nTNT,$if2(%title%,%_cNoTitle%))

$noop(
-----------------------------------------------------------------------
-  Trim the album and track names used to create directories and tracks
-  if they are longer than the maximum lengths set in the "Constants"
-  section.
-----------------------------------------------------------------------
)
$if($gt($len(%_nANT%),%_aTitleMaxLength%),$set(_nANT,$left(%_nANT%,$sub(%_aTitleMaxLength%,3))...))
$if($gt($len(%_nTNT%),%_tTitleMaxLength%),$set(_nTNT,$left(%_nTNT%,$sub(%_tTitleMaxLength%,3))...))


$noop(
#######################################################################
#
#  Initialize Working Variables
#
#######################################################################
)
$set(_nMedia,%media%)
$set(_nTotalDiscs,$if2(%totaldiscs%,1))
$set(_nDiscNum,$if2(%discnumber%,1))
$set(_nTotalTracks,$if2(%totaltracks%,1))
$set(_nTrackNum,$if2(%tracknumber%,1))
$set(_nAlbumArtistID,$if2(%musicbrainz_albumartistid%,%_kUnKnownArtistID%))
$set(_nInitial,~ $upper($firstalphachar(%_nFAAPS%,#)) ~/)

$noop(
-----------------------------------------------------------------------
-  If standardized primary album artist is different from credited
-  primary track artist [other than prefix] show in track file name.
-  Otherwise, show any additional credited track artists in track file
-  name.
-----------------------------------------------------------------------
)
$set(_tAlbumArtist,$lower($delprefix(%_nPAA%)))
$set(_tTrackArtist,$lower($delprefix(%_nPTA%)))
$if($eq(%_tAlbumArtist%,%_tTrackArtist%),
    $set(_nFeat,$if(%_nATA%, [feat. %_nATA%],)),
    $set(_nFeat, [%_nFTA%])
)

$set(_nYear,[$left($if2(%originaldate%,%originalyear%,%date%,0000),4)])
$set(_nTNum,$if($gt(%_nTotalDiscs%,1),$num(%_nDiscNum%,2)-,)$num(%_nTrackNum%,2))


$noop(
#######################################################################
#
#  Set Album Type [Single, Soundtrack or Standard]
#
#  Process as Soundtrack
#	Format: /[Soundtrack]/[year] Album/Disc-Track Title [Artist]
#
#  Process as Single
#	Formats: /~ A ~/Album Artist/[~Singles~]/[year] Title [feat.]
#
#  Process as Standard
#	Formats: /~ A ~/Album Artist/[year] Album/Disc-Track Title [feat.]
#                /~ # ~/Album Artist/[year] Album/Disc-Track Title [feat.]
#                /[Various Artists]/[year] Album/Disc-Track Title [Artist]
#                /[Unknown Artists]/[year] Album/Disc-Track Title [Artist]
#
#######################################################################
)
$set(_t1,1=)
$set(_t1,%_t1%$if($lte(%_nTotalDiscs%,1),Y,N))
$set(_t1,%_t1%$if($lte(%_nTotalTracks%,1),Y,N))
$set(_t1,%_t1%$if($in(%_primaryreleasetype%,single),Y,N))
$if($eq(%_t1%,1=YYY),$set(_nAlbumType,Single))

$set(_t2,2=)
$set(_t2,%_t2%$if($eq(%_nAlbumArtistID%,%_cVariousArtistID%),Y,N))
$set(_t2,%_t2%$if($in(%_secondaryreleasetype%,soundtrack),Y,N))
$if($eq(%_t2%,2=YY),$set(_nAlbumType,Soundtrack))

$set(_nAlbumType,$if2(%_nAlbumType%,Standard))


$noop(
#######################################################################
#
#  Set File Path
#
#######################################################################
)
$if($eq(%_nAlbumType%,Soundtrack),$set(_nFilePath,%_cSoundtrack%/%_nYear% %_nANT%/))
$if($eq(%_nAlbumType%,Single),$set(_nFilePath,%_nInitial%/%_nPAAS%/%_cSingles%/))
$if($eq(%_nAlbumType%,Standard),$if($eq($if2(%musicbrainz_albumartistid%,%_cVariousArtistID%),%_cVariousArtistID%),
    $set(_nFilePath,%_cVariousArtist%/%_nYear% %_nANT%/),
    $if($eq($if2(%musicbrainz_albumartistid%,%_cUnknownArtistID%),%_cUnknownArtistID%),
        $set(_nFilePath,%_cUnknownArtist%/%_nYear% %_nANT%/),
        $set(_nFilePath,%_nInitial%/%_nFAAPS%/%_nYear% %_nANT%/)
)))


$noop(
#######################################################################
#
#  Set File Name
#
#######################################################################
)
$if($eq(%_nAlbumType%,Soundtrack),$set(_nFileName,%_nTNum% %_nTNT%%_nFeat%))
$if($eq(%_nAlbumType%,Single),$set(_nFileName,%_nYear% %_nTNT%%_nFeat%))
$if($eq(%_nAlbumType%,Standard),$set(_nFileName,%_nTNum% %_nTNT%%_nFeat%))

$noop(
-----------------------------------------------------------------------
-  Trim the file name if it is longer than the maximum length set in
-  the "Constants" section.
-----------------------------------------------------------------------
)
$if($gt($len(%_nFileName%),%_tFilenameMaxLength%),$set(_nFileName,$left(%_nFileName%,$sub(%_tFilenameMaxLength%,3))...))


$noop(
#######################################################################
#
#  Output the path and file name to use.
#
#######################################################################
)

%_nFilePath%/%_nFileName%


$noop(
#######################################################################
#
#  End of script.
#
#######################################################################
)

I hope this helps.

EDIT: Before anybody tells me that the code could be tightened up and shortened by combining things like the album type testing, I already know that. :wink: I tried to write this as generically as possible so that it could be (relatively) easily modified to suit a particular desired output. That’s also why I tried to create each of the naming “elements” first, and then just assemble them in the desired order at the end. Hopefully the various comments throughout will help anyone wanting to use this as a starting point for their own file naming script.

EDIT: I just realized that this might be more appropriate in the Repository for neat file name string patterns and tagger script snippets thread. @Freso, if you agree, can you please move it? Thanks.

3 Likes

Hi rdswift, I don’t know why I am not receiving any email notifications in spite of having it enabled in the settings. Just saw your response. Thank you so much for taking out your time to help with the script.

Can you please confirm if the script would create separate folders for soundtrack, singles, and standard albums? I wanted all of them into one album artist folder. Also, being a rookie, I don’t think I have the skill to make any tweakings to your plugin :smile: . At least, can you point me to a particular section of the plugin that I should be looking for?

I thought I was trying to keep it simple (lol). I was wondering if I could just use the script to rename and structure the folders. The metadata copied from Picard or MB database should automatically override the title name by default, right?

FragaGeddon,

Would you be able to add options for release country, file format? Images as example. Only necessary for folders I think.

@FragaGeddon I have played around with you code and have reworked it to give me the results I like. Thank you for the nice setup work!

I was going to edit my original post, but apparently there’s a time limit on edits. I recently made a change to my script to handle releases with more than 100 tracks. So I’m posting my updated script here.

This script gives a layer of folders with the initial letter of the album artist sort name, then the sort name itself, next the album name, with release comment, and single or EP if appropriate. The songs are in the form: Track number - artist - title. Multiple disc releases are all in the same folder with the disc number tacked on to the front of the track number.
Back at the root level, there are separate folders for soundtracks and various artist compilations. Under those, there’s another layer of initial letters, this time of the swapprefix’ed album names, then those names, with the file names under those in the same format as before.

Examples:
Tagged Music\~D~\Dylan, Bob\Blood on the Tracks\01 - Bob Dylan - Tangled Up in Blue.mp3
Tagged Music\~C~\Crosby, Bing\Bing Sings 96 of His Greatest Hits\711 - Bing Crosby with The Andrews Sisters - Vict’ry Polka.mp3
Tagged Music\Soundtrack\~W~\Wizard of Oz, The\02 - Harold Arlen - Over the Rainbow.mp3
Tagged Music\Various Artists\~1~\1959- Jazz’s Greatest Year\02 - Miles Davis & Gil Evans - The Pan Piper.mp3
Tagged Music\~M~\Mann, Manfred, Earth Band\Blinded by the Light _ Spirit in the Night (Single)\01 - Manfred Mann’s Earth Band - Blinded By The Light.mp3
Tagged Music\~D~\Dire Straits\ExtendedancEPlay (EP)\01 - Dire Straits - Twisting by the Pool.mp3
Tagged Music\~R~\Rush\R40 Live (Only @ Best Buy version with starman flashlight)\210 - Rush - 2112.mp3
Tagged Music\Soundtrack\~S~\Sid Meier’s Civilization IV (game rip)\7103 - Michael Curran, Mark Cromer & Jeff Briggs - Washington Middle.mp3

$replace(
$replace(
$replace(
$replace(
$replace(
$replace(
$if($in(%releasetype%,soundtrack),
	$noop(Soundtracks)
	Soundtrack/~
	$left($swapprefix(%album%,A,An,The),1)~/$swapprefix(%album%,A,An,The)
	$if(%_releasecomment%, \(%_releasecomment%\),$noop())
	$if($in(%releasetype%,single), \(Single\),$noop())
	$if($in(%releasetype%,ep), \(EP\),$noop())/
	$if($gt(%totaldiscs%,1),%discnumber%,$noop())
	$if($gt(%_totalalbumtracks%,99),$num(%tracknumber%,3),$num(%tracknumber%,2)) - %artist% - %title%,
		$if($eq(%albumartist%,Various Artists),
		$noop(Various artist albums)
		Various Artists/~
		$left($swapprefix(%album%,A,An,The),1)~/$swapprefix(%album%,A,An,The)
		$if(%_releasecomment%, \(%_releasecomment%\),$noop())
		$if($in(%releasetype%,single), \(Single\),$noop())
		$if($in(%releasetype%,ep), \(EP\),$noop())/
		$if($gt(%totaldiscs%,1),%discnumber%,$noop())
		$if($gt(%_totalalbumtracks%,99),$num(%tracknumber%,3),$num(%tracknumber%,2)) - %artist% - %title%,
		$noop(Normal albums)
		~$left($if2(%albumartistsort%,%artistsort%,%albumartist%,%artist%),1)~/
		$if2(%albumartistsort%,%artistsort%,%albumartist%,%artist%)/%album%
		$if(%_releasecomment%, \(%_releasecomment%\),$noop())
		$if($in(%releasetype%,single), \(Single\),$noop())
		$if($in(%releasetype%,ep), \(EP\),$noop())/
		$if($gt(%totaldiscs%,1),%discnumber%,$noop())
		$if($gt(%_totalalbumtracks%,99),$num(%tracknumber%,3),$num(%tracknumber%,2)) - %artist% - %title%)
)
,*,[x])
,?,)
,:,-)
,",')
,<,{)
,>,})
5 Likes

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

I like the script and using it…had to move the date to the beginning of the album folder name but that’s just how I organize, by date. Just a quick question…where did you get Additional Artists Variables plugin?

Plugin:

Thank you very much :slight_smile:

@hbrtkp I am using This script and I really like it. I was wondering if you could show me how to add
$if($eq(%media%,SHM-CD), [SHM-CD])
and add if [CBR 320] for mp3’s that are.
That would do it for me, Thanks.

It depends on where this information should be displayed. If at the end, do this:

$swapprefix($if2(%_artists_album_primary_std%,%artist%),The,Die,Le)
/$replace($replace($replace($replace($replace($replace($swapprefix($if2(%albumartist%,%artist%),The,Die,Le), and , & ),+,&), with , & ), _ , & ), vs , & ), vs. , & ) - $replace($truncate(%album%,100),:,-)
$set(album,$if($title(%_releasecomment%),%album% \($title(%_releasecomment%)\),%album%))

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

$if($eq(%media%,LP), [Vinyl])
$if($eq(%media%,Vinyl), [Vinyl]))
$if($eq(%media%,7" Vinyl), [Vinyl])
$if($eq(%media%,10" Vinyl), [Vinyl])
$if($eq(%media%,12" Vinyl), [Vinyl])
$if($eq(%media%,Cassette), [Cassette])

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

$if($ne_all(%catalognumber%,none,[none]),$if(%catalognumber%, [$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,)
$if($gt(%_sample_rate%,48000), $div(%_sample_rate%,1000)kHz,)

$if($eq(%media%,SHM-CD), [SHM-CD],)
$if($eq(%_bitrate%,320.0), [CBR 320],)

/$if($gt(%totaldiscs%,1),CD$num(%discnumber%,2)$if(%discsubtitle%, - %discsubtitle%,))
/$num(%tracknumber%,2). $if(%_multiartist%,%artist% - ,)%title%

If elsewhere, paste the code into a free line in the required place.

For the remaining bitrates, use this (works only with CBR files):

$if($eq(%_bitrate%,320.0), [CBR 320],)
$if($eq(%_bitrate%,256.0), [CBR 256],)
$if($eq(%_bitrate%,192.0), [CBR 192],)
$if($eq(%_bitrate%,160.0), [CBR 160],)
$if($eq(%_bitrate%,128.0), [CBR 128],)
$if($eq(%_bitrate%,64.0), [CBR 64],)

Effect:
obraz

1 Like

Got it, Thanks so much. Really like this script so far! :wink:

I’m almost there…
Just wanted to share with everyone my script so far. Really have to thank @hbrtkp for all the inspiration and the base of this script. Now v2.0

1st you will need 3 scripting files
1: 4 Digit Date: $set(date,$left(%date%,4))
2: Release Comment: $set(album,$if(%_releasecomment%,%album% ($title(%_releasecomment%)),%album%))
3: Remove feat from album title: $set(album,$rreplace(%album%,\s\(feat. [^)]+\),))

$if($gt(%_bits_per_sample%,16),-=[%_bits_per_sample%bit]=-,)/
$upper(%_extension%)/
$if($inmulti(%releasetype%,soundtrack),Soundtracks,$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($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($eq(%releasetype%,single),-(CDM 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($gt(%_bits_per_sample%,16),-[%_bits_per_sample%bit,)
$if($gt(%_sample_rate%,48000), $div(%_sample_rate%,1000)kHz],)
$if($in(%media%,Vinyl),-VINYL,)
$if($in(%media%,Cassette),-CASSETTE,)
$if($eq(%media%,Hybrid SACD),-[Hybrid-SACD],)
$if($eq(%media%,SACD),-[SACD],)
$if($eq(%media%,SHM-CD),-[SHM-CD],)
$if($eq(%media%,SHM-SACD),-[SHM-SACD],)
$if($eq(%media%,Digital Media),-WEB,)
$if($eq(%media%,Blu-spec CD),-[BLU-SPEC],)
$if($in(%media%,CD),$if($gt(%totaldiscs%,1),-%totaldiscs%CD,-CD),)
$if($in(%media%,Vinyl),$if($gt(%totaldiscs%,1),-%totaldiscs%LP,),)
$if($in(%media%,Digital Media),$if($gt(%totaldiscs%,1),-%totaldiscs%xDIGITAL MEDIA,),)
$if($ne(%_extension%,mp3),$upper(-%extension%))
$if(%date%,-%date%,)-PiCARD, ,
)
/$if($in(%media%,Vinyl),$if($gt(%totaldiscs%,1),LP$num(%discnumber%,2)$if(%discsubtitle%, - %discsubtitle%,)))
$if($in(%media%,CD),$if($gt(%totaldiscs%,1),CD$num(%discnumber%,2)$if(%discsubtitle%, - %discsubtitle%,)))
$if($in(%media%,Digital Media),$if($gt(%totaldiscs%,1),Digital Media $num(%discnumber%,2)$if(%discsubtitle%, - %discsubtitle%,)))
/$if($in(%media%,Vinyl),%_musicbrainz_tracknumber%,$if($gt(%totaldiscs%,1),%discnumber%,)$num(%tracknumber%,2)). $if($and(%_multiartist%,$not($inmulti(%releasetype%,soundtrack))),%artist% - ,)$truncate(%title%,70)

Effect:
Annotation%202019-10-27%20111733

3 Likes

Hello,
your script is excellent.
Would you please a “genre” metatag parenting all this?
Thank you in advance.

My workflow is to place the items in directories based who, what, when then format type, finally the tracks and their bit rate if applicable.

This way I can just keep an ongoing archive and add to it. For the playable music library I’ll duplicate from the archive to that location.

Incomplete Albums are also placed along side the others in the Artists or other Root Folder type.

29-Sept, 2019 - I updated the script, cleaned up orphaned bits, added more configuration options to dis/enable things instead of having to comment them out.

This way I can see what I have both by file type and quality where applicable. The files will have the sample rate and bit rate in the filename as applicable so I can compare quality among the same file format.

Duplicate File Handling: (As shown in my screen shot)

Picard handles duplicate files by placing them in the same directory with an appended filename. (…music/A/Artist/Album/File.ext, …music/A/Artist/Album/File(1).ext, etc.

I wanted the duplicates to be placed in a separate directory at the prior level, (…music/A/Artist/Album, …music/A/Artist/Album(1), etc. instead.

This script works transparently with either configuration, however the latter does require a source code change at this time. That is, you will have to change in the application source code to get this alternate behavior.

This is for several reasons, most having to do with not wanting to rename files when settling on which to use for a particular player/application. Although the need for ‘renaming’ is brought to a minimum when the filename is set to include several file specific metrics. That means those close but not identical named tracks will end up in the same album directory and not the incrememtial duplicate locatoin.

All of that is because I use Picard to organize the data from an archival viewpoint. I target Picard’s output to a directory tree for archiving and I can choose what I want from there when sifting out a set of files for the playback method/hardware. It also makes taking similar files that would have been named as a duplicate otherwise a bit more efficient.

See this thread for details on the source code modification for the latter behavior:

$noop(★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★)
$noop(★ MBP YA Magic-Script that does more stuff too. - v1.6 --amd/17500mph  ★)
$noop(★                                                                      ★)
$noop(★ Here is a script for music renaming in MusicBrainz Picard            ★)
$noop(★                                                                      ★)
$noop(★ Features :                                                           ★)
$noop(★ - Organize root music directory by last.fm** category OR artist      ★)
$noop(★ - Can use custom subDirectory for each main type [Album/Single/EP...]★)
$noop(★ - Separate Root directory for compilations [!various]                ★)
$noop(★ - Type Album [Artist inclusive] can be excluded from Compilations    ★)
$noop(★ - Root directory Audio Books, Podcasts, Others                       ★)
$noop(★ - Alphabetize artist without leading "The"                           ★)
$noop(★ - Show Album Release Status on Album Directory                       ★)
$noop(★ - Show Record Label on Directory Name Directory                      ★)
$noop(★ - Show Track Duration in Filename                                    ★)
$noop(★ - Show Catalogue Number in Album Directory Name                      ★)
$noop(★ - Filtered character for files & directory naming                    ★)
$noop(★ - Include media type in directory name [when its not CD]             ★)
$noop(★ - Multi-Disc SubDirectory per Disc in Album Directory                ★)
$noop(★ - Custom directory tag for multi-disc CD/Vinyl [CD1/Disc1 by default]★)
$noop(★ - Put multi-CD release in same directory [names become 101/102/201..]★)
$noop(★ - Vinyl can use musicbrainz style for track [A1/A2/B1...]            ★)
$noop(★ - Put incomplete in separate album level named directory             ★)
$noop(★ - Added subDirectory for type [video]                                ★)
$noop(★ - Lossy / Lossless** at root directory                               ★)
$noop(★ - File Type SubDirectory in Album Directory                          ★)
$noop(★                                                                      ★)
$noop(★ ** Optional Plugins Needed for certain options:                      ★)
$noop(★   - Last.fm.ng plugin [for category trending]                        ★)
$noop(★   -> https://github.com/fdemmer/Picard-Last.fm.ng-Plugin             ★)
$noop(★                                                                      ★)
$noop(★ Plugin for is_lossless / is_lossy                                    ★)
$noop(★ https://community.metabrainz.org/t/categorizing-lossless-music/258530★)
$noop(★                                                                      ★)
$noop(★ Do Not Taunt The Happy Tagging Ball                                  ★)
$noop(★                                                                      ★)
$noop(★----------------------------------------------------------------------★)
$noop(★   Based on the MBP Magic Script  By Ski-lleR                         ★)
$noop(★   Thanks to avibrazil for his filter                                 ★)
$noop(★ > https://github.com/avibrazil/picard-scripting                      ★)
$noop(★----------------------------------------------------------------------★)
$noop(★                                                                      ★)
$noop(★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★)

$noop(★ INSERT COIN ★)

$noop(Configuration Section - 0-Disable / 1-Enable)

$noop(★ GLOBAL ★)
$set(_separateByTypeInArtistDirectory,1) $noop(Album Name/EP/Single/Live/Tribute etc.)
$set(_separateAlbum,0) $noop(Albums in SubDirectory as well)
$set(_useMusicBrainzStyleForVinylTrack,1)
$set(_extraTrackHandling,1) 


$noop(★ Multi-Disc ★)
$set(_useSubDiscDirectory,1)
$set(_mergeDiscWhenNotUsingSubDirectory,0)
$set(_showDiscSubtitle,1)
$set(_nameForTypeCD,Disc)
$set(_nameForTypeVinyl,Side)


$noop(★ Separate at Root Level by two main categories ★)
$set(_rootLossyLess,0)
$set(_lossySubDirectory,MP3/)
$set(_losslessSubDirectory,FLAC/)


$noop(★ orderTypeForRoot ★)
$noop(★  1: Category [Last.fm.ng] ★)
$noop(★  2: Artist first letter ★)
$set(_orderTypeForRoot,2)


$noop(★ orderTypeForArtist ★)
$noop(★  1: First letter of first name ★)
$noop(★  2: First letter of last name ★)
$set(_orderTypeForArtist,2)


$noop(★ CUSTOM SUBDIRECTORY BY TYPE ★)
$set(_albumSubDirectory,Album/)
$set(_coverSubDirectory,[Cover]/)
$set(_singlesSubDirectory,[Single]/)
$set(_epSubDirectory,[EP]/)
$set(_broadcastSubDirectory,[Broadcast]/)
$set(_videoSubDirectory,[Video]/)
$set(_otherSubDirectory,[Others]/)
$set(_extDirectory,%_extension%/)


$noop(★ Tribute / Cover Sort Settings [NO VARIOUS] ★)
$set(_altArtistSort,1/)
$set(_liveSubDirectory,[Live]/)
$set(_tributeSubDirectory,[Tribute]/)


$noop(★ COMPILATION DIRECTORY [NO VARIOUS] ★)
$set(_compilationsASubDirectory,Compilation/)
$set(_compilationsGSubDirectory,Compilations/)


$noop(★ SOUNDTRACK/VARIOUS DIRECTORY ★)
$set(_soundTracksDirectory,Soundtrack/)
$set(_variousArtistsDirectory,Various/)
$set(_audiobooksDirectory,Audiobook/)
$set(_incompleteDirectory,Partial)
$set(_podcastSubDirectory,Podcast/)


$noop(★ Other Values Included in Filename ★)
$set(_showRecordLabel,1)
$set(_showTime,1)
$set(_showReleaseType,1)
$set(_showBandwidth,1)
$set(_showCatalogueNumber,1)

$noop(####################### END SETTINGS #######################)

$noop(★ Unless you're changing appearances, there isn't really anything to do past here ★)

$noop(########## DETECT MUSIC TYPE ###############################)

$noop(★ Detect Album ★)
$if($in(%releasetype%,album),
  $set(_isAlbum,1)
)

$noop(★ Detect Single ★)
$if($in(%releasetype%,single),
  $set(_isSingle,1)
)

$noop(★ Detect EP ★)
$if($in(%releasetype%,ep),
  $set(_isEP,1)
)

$noop(★ Detect Broadcast ★)
$if($in(%releasetype%,broadcast),
  $set(_isBroadcast,1)
)

$noop(★ Detect Audiobook ★)
$if($in(%releasetype%,audiobook),  $set(_isAudiobook,1)
)

$noop(★ Detect Other ★)
$if($in(%releasetype%,other),
  $set(_isOther,1)
)

$noop(★ Detect Artist Compilation ★)
$if($in(%releasetype%,compilation),
  $set(_isArtistCompil,1)
)

$noop(★ Detect Live ★)
$if($in(%releasetype%,live),
  $set(_isLive,1)
)

$noop(★ Detect Tribute ★)
$if($in(%albumsort%,Tribute),
  $set(_isTribute,1)
)

$noop(★ Detect Cover ★)
$if($in(%albumsort%,Cover),
  $set(_isCover,1)
)

$noop(★ Detect Podcast ★)
$if($in(%genre%,Podcast),
  $set(_isPodcast,1)
)

$noop(★ Detect Soundtrack ★)
$if($in(%releasetype%,soundtrack),
  $set(_isSoundTrack,1)
)
$noop(★ Detect Incomplete ★)
$if($eq($is_complete(),0),
  $set(_isIncomplete,1)
)

$noop(★ Detect Video ★)
$if($eq($is_video(),0),
  $set(_isVideo,1)
)

$noop(★ Detect Various Artist ★)
$if($eq(%albumartist%,Various Artists),
  $set(_isVarious,1)
)

$noop(★ Re-detect Compilation ★)
$if($eq(%compilation%,1),
  $set(_isGlobalCompil,1)
)
	$if($eq(%_isGlobalCompil%,1), $set(_isArtistCompil,0) )

$noop(★ Get Track Length ★)
$if($eq(%_showTime%,1),
  $noop($set(_trackLength,%length%))
)
$noop(########## TAG MANAGE ######################################)

$noop(★ Organize artist by alphabetical Directorys excluding leading The ★)
$set(albumartist,$if($eq($left(%albumartist%,4),The ),%albumartistsort%,%albumartist%))


$noop(########## TAG CLEANUP  ####################################)

$noop(★ Typography for tags: changes will affect tags on media ★)

$noop(★ ... ➡ …)
$set(album,$replace(%album%,...,…))
$set(title,$replace(%title%,...,…))
$set(discsubtitle,$replace(%discsubtitle%,...,…))

$noop(★ No. ➡ №)
$set(album,$replace(%album%, [Nn]o.\\s*\(\\d\), №\\1))
$set(title,$rreplace(%title%, [Nn]o.\\s*\(\\d\), №\\1))
$set(discsubtitle,$replace(%discsubtitle%, [Nn]o.\\s*\(\\d\), №\\1))

$noop(★ [digit]" ➡ [digit]″)
$set(discsubtitle,$rreplace(%discsubtitle%,\(\\d\)",\\1''))

$noop(★ "12" Vinyl" ➡ "12 Inch Vinyl")
$set(media,$rreplace(%media%,\(\\d\)",\\1 Inch))
$set(album,$rreplace(%album%,\(\\d\)",\\1 Inch))
$set(title,$rreplace(%title%,\(\\d\)",\\1 Inch))

$noop(★ "something" ➡ “something” single quote for server/samba)
$set(albumartist,$rreplace(%albumartist%,"\(.*?\)",'\\1'))
$set(artist,$rreplace(%artist%,"\(.*?\)",'\\1'))
$set(albumartistsort,$rreplace(%albumartistsort%,"\(.*?\)",'\\1'))
$set(artistsort,$rreplace(%artistsort%,"\(.*?\)",'\\1'))
$set(album,$rreplace(%album%,"\(.*?\)",'\\1'))
$set(title,$rreplace(%title%,"\(.*?\)",'\\1'))
$set(discsubtitle,$rreplace(%discsubtitle%,"\(.*?\)",'\\1'))

$noop(★ Typography on file naming only ★)
$set(_titleForFilename,%title%)
$set(_albumForFilename,%album%)
$set(_discsubtitleForFilename,%discsubtitle%)
$set(_albumartistForFilename,%albumartist%)
$set(_artistForFilename,%artist%)
$set(_albumartistsortForFilename,%albumartistsort%)
$set(_artistsortForFilename,%artistsort%)

$noop(★ # ➡ ♯)
$set(_titleForFilename,$replace(%_titleForFilename%,#,♯))
$set(_albumForFilename,$replace(%_albumForFilename%,#,♯))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,#,♯))

$noop(★ ;: ➡ h, m,)
$set(_trackLength,$replace(%_trackLength%,:,m))

$noop(★ : ➡ ∶)
$set(_titleForFilename,$replace(%_titleForFilename%,:,∶))
$set(_albumForFilename,$replace(%_albumForFilename%,:,∶))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,:,∶))
$set(_artistForFilename,$replace(%_artistForFilename%,:,∶))
$set(_albumartistForFilename,$replace(%_albumartistForFilename%,:,∶))
$set(_artistsortForFilename,$replace(%_artistsortForFilename%,:,∶))
$set(_albumartistsortForFilename,$replace(%_albumartistsortForFilename%,:,∶))

$noop(★ ? ➡ ⁇)
$set(_titleForFilename,$replace(%_titleForFilename%,?,⁇))
$set(_albumForFilename,$replace(%_albumForFilename%,?,⁇))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,?,⁇))
$set(_artistForFilename,$replace(%_artistForFilename%,?,⁇))
$set(_artistsortForFilename,$replace(%_artistsortForFilename%,?,⁇))

$set(_titleForFilename,$replace(%_titleForFilename%,|,│))
$set(_albumForFilename,$replace(%_albumForFilename%,|,│))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,|,│))

$set(_titleForFilename,$replace(%_titleForFilename%,>,>))
$set(_albumForFilename,$replace(%_albumForFilename%,>,>))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,>,>))

$set(_titleForFilename,$replace(%_titleForFilename%,<,<))
$set(_albumForFilename,$replace(%_albumForFilename%,<,<))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,<,<))

$set(_titleForFilename,$replace(%_titleForFilename%,*,✱))
$set(_albumForFilename,$replace(%_albumForFilename%,*,✱))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,*,✱))
$set(_artistForFilename,$replace(%_artistForFilename%,*,✱))
$set(_albumartistForFilename,$replace(%_albumartistForFilename%,*,✱))
$set(_artistsortForFilename,$replace(%_artistsortForFilename%,*,✱))
$set(_albumartistsortForFilename,$replace(%_albumartistsortForFilename%,*,✱))

$set(_titleForFilename,$replace(%_titleForFilename%,&,&))
$set(_albumForFilename,$replace(%_albumForFilename%,&,&))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,&,&))
$set(_artistForFilename,$replace(%_artistForFilename%,&,&))
$set(_albumartistForFilename,$replace(%_albumartistForFilename%,&,&))
$set(_artistsortForFilename,$replace(%_artistsortForFilename%,&,&))
$set(_albumartistsortForFilename,$replace(%_albumartistsortForFilename%,&,&))

$noop(★ Pathname Generation Starts Here ★)

$noop(★ Root level Path ★)
$noop(root = 'Destination Directory from above')

$noop(root)
$noop(root)
$noop(root)

$noop(★ Separate Lossy/Lossess types at root directory - Requires plugin ★)

$if($eq(%_rootLossyLess%,1),$if($is_lossless(),%_losslessSubDirectory%,%_lossySubDirectory%/))

$noop(root/Lossy)
$noop(root/Lossless)
$noop(root/Lossy)

$noop(★ Soundtrack in custom directory ,after soundtracksDirectory?? ★)

$noop(root/Lossy/Audio)
$noop(root/Lossy/Soundtracks)
$noop(root/Lossless/Various)
$noop(root/Lossy/Category)

$if(%_isSoundTrack%,%_soundTracksDirectory%,
$if(%_isAudiobook%,%_audiobooksDirectory%)
$if(%_isPodcast%,%_podcastDirectory%)


$noop(★ Various in custom directory ★)
$noop(root/<*>/Various)
$if(%_isVarious%,%_variousArtistsDirectory%,
	$if(%_isGlobalCompil%,%_compilationsGSubDirectory%,)
	$noop(★ Order root by category ★)
	$if($eq(%_orderTypeForRoot%,1),
	$if2(%albumgrouping%,Unknown)
	)/

$noop(★ Order root by artist ★)
$noop(root/<*>/<Last.FM=>/)
$noop(root/<*>/D/)
$if($eq(%_orderTypeForRoot%,2),
	$if($eq(%_orderTypeForArtist%,1),
		$upper($firstalphachar($if2(%_albumartistForFilename%, %_artistForFilename%),#)),
	$if($eq(%_orderTypeForArtist%,2),
		$if(%_isGlobalCompil%,,$upper($firstalphachar($if2(%_albumartistsortForFilename%, %_artistsortForFilename%),#)))
	))
)/

$noop(★ Artist with first letter of first name ★)
$noop(root/<*>/B/The B-52's)
$if($eq(%_orderTypeForArtist%,1),
$if2(%_artistSort%,%_albumartistForFilename%,%_artistForFilename%)
)/

$noop(★ Artist with first letter of last name ★)
$noop(root/<*>/B/B-52's, The)
$if($eq(%_orderTypeForArtist%,2),
$if(%_isGlobalCompil%,,$if2(%_albumartistsortForFilename%,%_artistsortForFilename%))
)/

$noop(★ Using Alternate Artists Directory For Covers & Tributes  **Uses Order for Album Artist tag [Field]★)

	$noop(root/<*>/O/Oingo Boingo/[Tributes]/DeadBandsParty)
	$if($eq_all(%_orderTypeForArtist%,%_isTribute%,1),
	$if2(%_artistSort%,%_albumartistForFilename%,%_artistForFilename%)
	)/

	$noop(root/<*>/D/DEVO/[Covers]/Devolution)
	$if($eq_all(%_orderTypeForArtist%,%_isCover%,1),
	$if2(%_artistSort%,%_albumartistForFilename%,%_artistForFilename%)
	)/

	$noop(★ Organize by type ★)
	$noop(root/<*>/Y/Yes/[Live]/90125 Live)
	$noop(root/<*>/Y/Yes,/90125)
	$if($eq(%_separateByTypeInArtistDirectory%,1),
		$if($eq(%_isArtistCompil%,1),%_compilationsASubDirectory%,
			$if($eq(%_isLive%,1),%_liveSubDirectory%,
				$if($eq(%_isCover%,1),%_coverSubDirectory%,
					$if($eq(%_isTribute%,1),%_tributeSubDirectory%,
						$if($eq(%_isAlbum%,1),
							$if($eq(%_separateAlbum%,1),%_albumSubDirectory%)

							$if($eq(%_isSingle%,1),%_singlesSubDirectory%)
							$if($eq(%_isEP%,1),%_epSubDirectory%)
							$if($eq(%_isBroadcast%,1),%_broadcastSubDirectory%)
							$if($eq(%_isVideo%,1),%_videoSubDirectory%)
							$if($eq(%_isOther%,1),%_otherSubDirectory%)
							)
						)
					)
				)
			)
		)
	)
)

%_albumForFilename%
$noop($if($ne(%media%,CD),$if(%media%,[$rreplace(%media%,["″], Inch)])))
$noop(root/<*>/B/B-52's, The]/Bouncing off the Satellites [Vinyl])
$if($and(%media%,$ne(%media%,CD)), [%media%])
$noop(★ Bouncing off the Satellites [Vinyl] - [YEAR] [Media-Type][CDx~subtitle]/ or /CDx~subtitle/ ★)
$if($if2(%date%,%originalyear%,%originaldate%), [$left($if2(%date%,%originalyear%,%originaldate%),4)] ,[0000])
$noop(★ Bouncing off the Satellites [Vinyl] - [YEAR] [Media-Type][CDx~subtitle]/ or /CDx~subtitle/ [Official] ★)
$if($eq(%_showReleaseType%,1),$title([%releasestatus%]))
$if($eq(%_showCatalogueNumber%,1),$title([%catalognumber%]))
$noop(★ _extraTrackHandling,1 Complete Albums with Extra Tracks are not marked as Partials/Incompletes. Duplicate Tracks will be in a separately named Album Directory at the same Level. ★)
$noop(★ _extraTrackHandling,0 Complete Albums with Extra Tracks are treated as Partials/Incompletes ★)

$noop(★ _incompleteDirectory,1 Specify Partial/Incomplete Album Directory Name. ★)
$noop(★ _incompleteDirectory,0 Do not use a separate Directory for Partials/Incompletes/Overcompletes [Albums with Extra or Missing Tracks] ★)

$if($eq(%_extraTrackHandling%,1),$if($eq($is_complete(),0),$if($lt($matchedtracks( ),%_totalalbumtracks%), - %_incompleteDirectory%)),$if(%_isIncomplete%,- %_incompleteDirectory%,))
$upper(/%_extension%)

$if($gt(%totaldiscs%,1),$noop(
	)$if($lt(%totaldiscs%,10),$set(_discnumber, %discnumber%),$set(_discnumber,$num(%discnumber%,2)))$noop(
	)$if($in(%media%,Vinyl),$noop(
		)$set(_nameForDiscDirectory,@OSLASH@@OBRACKET@%_nameForTypeVinyl%%_discnumber%@CBRACKET@),$noop(
		)$set(_nameForDiscDirectory,@OSLASH@@OBRACKET@%_nameForTypeCD%%_discnumber%@CBRACKET@))$noop(
		)$if($and(%_discsubtitleForFilename%,$eq(%_showDiscSubtitle%,1)),$set(_nameForDiscDirectory,%_nameForDiscDirectory% - %_discsubtitleForFilename%))$noop(
		)$if($eq(%_useSubDiscDirectory%,1),$noop(
			)$set(_nameForDiscDirectory,$replace(%_nameForDiscDirectory%,@OSLASH@@OBRACKET@,/))$noop(
			)$set(_nameForDiscDirectory,$replace(%_nameForDiscDirectory%,@CBRACKET@,)),$noop(
			)$if($eq(%_mergeDiscWhenNotUsingSubDirectory%,1),$noop(
				)$unset(_nameForDiscDirectory),$noop(
				)$set(_nameForDiscDirectory,$replace(%_nameForDiscDirectory%,@OSLASH@@OBRACKET@,[))$noop(
			)$set(_nameForDiscDirectory,$replace(%_nameForDiscDirectory%,@CBRACKET@,]))$noop(
		))$noop(
	))$noop(
)$if(%_nameForDiscDirectory%,%_nameForDiscDirectory%))$if(%_showRecordLabel%, [%label%])/


$noop(Bitrate factors of 8.0 are CBR, Anything else is VBR)
$set(BRType,$if($eq_any(%bitrate%,320.0,256.0,224.0,192.0,160.0,128.0,112.0,96.0,80.0,64.0,56.0,48.0,40.0,32.0,24.0,16.0,8.0),CBR,VBR))
$noop(If it's VBR, What is the bitrate?)
$if($eq(%BRType%,VBR),$if($gte($left(%bitrate%,4),999),$set(%BrVBR%,$left(%bitrate%,4)),$set(%BrVBR%,$left(%bitrate%,3))))
$if($eq(%BRType%,CBR),
$if($eq(%bitrate%,320.0),$set(_filebr,320K),
$if($eq(%bitrate%,256.0),$set(_filebr,256K),
$if($eq(%bitrate%,224.0),$set(_filebr,224K),
$if($eq(%bitrate%,192.0),$set(_filebr,192K),
$if($eq(%bitrate%,160.0),$set(_filebr,160K),
$if($eq(%bitrate%,128.0),$set(_filebr,128K),
$if($eq(%bitrate%,112.0),$set(_filebr,112K),
$if($eq(%bitrate%,96.0),$set(_filebr,96K),
$if($eq(%bitrate%,80.0),$set(_filebr,80K),
$if($eq(%bitrate%,64.0),$set(_filebr,64K),
$if($eq(%bitrate%,56.0),$set(_filebr,56K),
$if($eq(%bitrate%,48.0),$set(_filebr,48K),
$if($eq(%bitrate%,40.0),$set(_filebr,40K),
$if($eq(%bitrate%,32.0),$set(_filebr,32K),
$if($eq(%bitrate%,24.0),$set(_filebr,24K),
$if($eq(%bitrate%,16.0),$set(_filebr,16K),
$if($eq(%bitrate%,8.0),$set(_filebr,8),
										))))))))))))))))))
$if($eq(%BRType%,VBR),
$if(%_filebr%,,
$if($gte(%BrVBR%,320),$set(_filebr, B 320),
$if($lt(%BrVBR%,220),$set(_filebr, V0),
$if($lt(%BrVBR%,190),$set(_filebr, V1),
$if($lt(%BrVBR%,170),$set(_filebr, V2),
$if($lt(%BrVBR%,150),$set(_filebr, V3),
$if($lt(%BrVBR%,140),$set(_filebr, V4),
$if($lt(%BrVBR%,130),$set(_filebr, V5),
$if($lt(%BrVBR%,120),$set(_filebr, V6),
))))))))))
$noop(★ Track. Title --%_filebr% -- %bitrate% -- %BRType% -- %BrVBR% --  ★)  
$if($in(%media%,Vinyl),$noop(
	)$if($eq(%_useMusicBrainzStyleForVinylTrack%,1),$noop(
		)$if(%_musicbrainz_tracknumber%,%_musicbrainz_tracknumber%. )$noop(
	)),$noop(
	)$if(%tracknumber%,$if($gt(%totaldiscs%,1),$if($and($eq(%_useSubDiscDirectory%,0),$eq(%_mergeDiscWhenNotUsingSubDirectory%,1)),%discnumber%))$num(%tracknumber%,2). ))
$noop(★ GAME OVER ★)
%_titleForFilename% 
$if($eq(%_showTime%,1),[%_length%])
$if($eq(%_showBandwidth%,1),[%_filebr%$left(%_bitrate%,3) %_sample_rate%KHz %BRType% %BrVBR%%_channels%ch])  

$noop(★ 00 CREDITS ★)

4 Likes

@Here4Pizza, can you give the code for your layout above please?

This is a fantastic pattern @tdiaz, thanks for publishing it! How would you go about to add the catalogue number to the most peripheral (the “last” one per album) folder?

Do you mean appending it to the album directory or one higher that contains the albums within? That may be the artist named directory, or the subdirectories for file type within the artist directory?

Volume/Music Sorted/B/B-52’s, The/M4A//Bouncing Across the Satellites/01. Track…
/Volume/Music Sorted/B/B-52’s, The/M4A/[catalogue]/Bouncing Across the Satellites [catalogue]/01. Track…

Either way, it’s going to be a scriptmtag droppd in the build process. One would hope there is never a reason for separate catalog numbers per track within an album.

That would be awkward to say the least. But nothing surprises me anymore. :sunglasses:

Hmm, I guess it would make most sense at the album level, so that this would be a great way of separate different pressings/versions of the same album. I’m actually not someone who has lot of these, but I have at least some old Aerosmith records on both vinyl and CD that I’d love to separate.
Anyway, thanks for a great script!

I updated it again. It’s got the Catalogue Number in it, too.

Pretty much every option is turned on, the configurations are all in the first section. You shouldn’t have to mess with the rest unless you want to move something around. I need to update the ‘sample paths’ in there, and a little bit more. I’m sick of looking at this thing right now. :wink:

OTOH, between that and the mods on the backside, I’ve got Picard doing all this anal sorting and labeling that I wanted.

Like I said previously, the target for this script is to put everything of the same name near each other, separated by file formats and to make handling things like duplicate tracks and such still give you a ‘perfect’ set of the album, and push the rest next to it.

Albums with too many tracks are no longer treated as incomplete.

So the only time you’ll see a ‘partial/incomplete’ marked directory is when you don’t have a complete one already. Any added incremental directories of that album themselves do -NOT- have a complete set will -NOT- be marked as incomplete because you already have a complete set.

/Volume/Drive/Music/O/Oingo Boingo/Only a Lad [1981]/ <-- the complete one.
/Volume/Drive/Music/O/Oingo Boingo/Only a Lad [1981] (1)/ <-- Any Duplicates End up here…
/Volume/Drive/Music/O/Oingo Boingo/Only a Lad [1981] (2)/ <-- and here if there’s more than one duplicate of something. It will just roll to the next incremental directory.

I’ll post another in a new post, with a new screen shot example, and the comments/instructions/examples in the script with more details.

4 Likes