Repository for neat file name string patterns and tagger script snippets

Thanks! I was placing the %date% at the wrong place, now it works!

1 Like

I’m trying to create a script that removes the (single) from single albums when tagging but I can’t get to replace it because of the parenthesis
is there a way around this?

From the documentation:

To use parentheses or commas as-is inside a function call, you must escape them with a backslash.

Thanks! That solved it, can’t believe I missed the whole paragraph while looking for it.

My first post so please bare with me folks. First off I would like say a huge thank you to everyone that contributes on here.

@tdiaz I’m using your wonderful script which is so well laid out but I am not a coder so trying to decipher how it all works and how to make changes. My biggest issue is the Bitrate / Sample Rate ($set(_showBandwidth,1) for example this is what I get as an output with a flac file [V0 96000KHz VBR 2ch]].flac, not sure if that’s a coding typo with the extra closing bracket after the 2ch.

Would it be possible incorporate something similar to the following:

I noticed that hbrkb showed how to add CBR rates to that further down so it must be possible to incorporate lossy codecs as well as lossless with this method.

I’m using v2.1a of the script as this was the latest version I could find here. I know you have been tweaking these settings and I did copy and paste the latest update from your last post.

The other little niggle for me though not quite as important is the Sort orderTypeForRoot by Artist first letter. If you get the time it would be great to have a 3rd option here to have the full Artist Name so basically eliminating that extra directory. I noticed when disabled I still get the Artist first letter within the Soundtrack and Various folder categories. I have yet to get the the last.fm plugin up and running so get an Unknown directory for standard albums.

Thank you for the script and I appreciate the time and effort you have put into it. I’ve got lots to learn regarding tagging scripts.

A post was split to a new topic: Using Series relationships for tagging

Any chance you could post an updated 2.6 or later script? I’m super close to where I want to be and this bit is what’s missing

I’m working on combining several large libraries. Most of the data is of reasonably consistent quality but there are redundant copies of albums in different MP3 quality (320, V0, V2, etc.). Some of those files are a little noisy in their bitrate so I’ve been struggling to find code that can deal with labeling these in terms of ranges rather than CBR static levels. Any ideas on how to format something that would capture the “general area” of bitrates associated with V0, V2 etc?

I mostly only ever deal with Flac and DSF files but it would be nice to have a script that dealt with all just for completeness. I’ve pretty much given up on the above which is based on the following:

https://community.metabrainz.org/t/sharing-my-renaming-script/82165

It’s much better because it is commented well and easy to understand. I have been playing with that now which is helping me learn along with reading and trying to understand rdswift’s script and others on here. I still haven’t quite got my head around what $noop is, which at first I thought was a way to comment out but then seen it being used as part of the code. I have tried searching for info on here with no luck.

I’m making some really good headway now though, spent the last 3 days and nights messing with scripts. My albums now look like the following example:

1971 - Greatest Hits - [CBS] [S69011] [GB] [12 Inch Vinyl] [1971-11] 24bit 96kHz

Next I want to try and integrate _isClassical with it’s own Classical directory Like Various and Soundtracks and make use of @rdswift Additional Artists Variables. The Last.fm.ng plugin I can’t install for the life of me on my Mac. I think there might be an error in the script path to the user Library > Preferences > MusicBrainz > Picard > plugins, I haven’t looked deeper into it so using the standard Last.fm one built in and have the script set to an Artists directory.

I have reminded myself now why I hate coding; time and frustration spent just like with html, javascripts and other code. I am wired now from lack of sleep. Passed my sleepy stage and now awake again when I should be trying to get some sleep. I’m turning into a vampire LOL I will crash and burn after about 4 days and 3 nights with cat naps in-between.

Your first thought was correct. It is a way of commenting, and it always returns an empty string. Anything enclosed within the brackets is treated as a comment and not processed. In my script, I use it in a few spots to comment out code that I’ve included for testing and such. I really should clean up my script and get rid of the commented out code. See the Picard on-line documentation project for a description of the functions, including examples.

If you want to see the Additional Artists Variables plugin in action, you might want to have a look at the renaming script that I use. Each of the sections is commented to try to explain what is being done in that section. If you have any questions about it, I’d be happy to try and clarify.

3 Likes
$noop(★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★)
$noop(★ MBP YA Magic-Script that does more stuff too. - v2.6c - amd/17500mph ★)
$noop(★                                                                      ★)
$noop(★ Here is a script for music renaming in MusicBrainz Picard            ★)
$noop(★                                                                      ★)
$noop(★ Note: Destination Director Setting                                   ★)
$noop(★       /Volumes/3TB/Licorice Pizza                                    ★)
$noop(★                                                                      ★)
$noop(★ Features :                                                           ★)
$noop(★                                                                      ★)
$noop(★   Individualy Selectable Root Directory Organization Options:        ★)
$noop(★ • Directories by [A]rtist Name / [N]ame, Artist or last.fm** category★)
$noop(★ • subDirectory for each main type [Album/Single/EP...]               ★)
$noop(★ • Separate Root directory for compilations [!various]                ★)
$noop(★ • Single Artist Compilations go in Artist Directory                  ★)
$noop(★ • Root directory Audio Books, Podcasts, Others                       ★)
$noop(★ • Root directory Genre PreSort                                       ★)
$noop(★  ~/MusicRoot/[O]/Oingo Boingo/[Artist Compilations]/                 ★)
$noop(★  ~/MusicRoot/Compilations/K-Tel Hits of the 1980s Vol. 1             ★)
$noop(★  ~/MusicRoot/Audio Books/Ready Player One                            ★)
$noop(★  ~/MusicRoot/Podcasts/Mad Mad Music #29                              ★)
$noop(★ - Alphabetize artist without leading "The"                           ★)
$noop(★ - Show Album Release Status on Album Directory                       ★)
$noop(★ - Show Record Label on Directory Name Directory                      ★)
$noop(★ - Show Catalogue Number in Album Directory Name                      ★)
$noop(★ - Show Track Duration in Filename                                    ★)
$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(★ - File Type SubDirectory in Album Directory                          ★)
$noop(★                                                                      ★)
$noop(★ - For Sort Directory Overrides: titlesort, artistsort, albumsort     ★)
$noop(★                                                                      ★)
$noop(★ ** Optional Plugin Needed for Last.fm [for category trending]        ★)
$noop(★   -> https://github.com/fdemmer/Picard-Last.fm.ng-Plugin             ★)
$noop(★                                                                      ★)
$noop(★ - 'For Sort Only'                                                    ★)
$noop(★   Do not format filename, optional limited [0m00s] [128 CBR]         ★)
$noop(★                                                                      ★)
$noop(★ - DevMode:                                                           ★)
$noop(★   Allows better simulation control of variables for debugging        ★)
$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(★ For Sort Only. No Filename Formatting - ★)
$noop(★   Usually for When Saving from Left   - ★)
$set(_quickNoNameFormat,0)

$noop(★ Values Included before File Ext. ★)

$if($eq(%_quickNoNameFormat%,1),$set(_showTime,0),$set(_showTime,1))
$if($eq(%_quickNoNameFormat%,1),$set(_showBandwidth,0),$set(_showBandwidth,1))

$set(_showRecordLabel,1)
$set(_showDate,1)
$set(_showReleaseStatus,1)
$set(_showCatalogueNumber,1)

$noop(★ For Development Only - Variable Settings in Subsections ★)
$noop(★ Where Available - Audio Metrics Only at this Time ★)
$set(_devMode,0)

$noop(★ GLOBAL ★)

$noop(★ Sort orderTypeForRoot ★)
$noop(★ ~/Music/Last.fm Genre/A/Artist/AlbumTitle/ ★)
$noop(★  1: Category [Last.fm.ng] ★)
$noop(★ ~/Music/A/Artist/AlbumTitle/ ★)
$noop(★  2: Artist first letter ★)
$set(_orderTypeForRoot,2)

$noop(★ Sort orderTypeForArtist ★)
$noop(★  1: First letter of first name ★)
$noop(★ ~/Music/M/Music Artist/AlbumTitle/  ★)
$noop(★  2: First letter of last name ★)
$noop(★ ~/Music/A/Artist, Music/AlbumTitle/  ★)
$set(_orderTypeForArtist,2)

$noop(★ How to designate Complete Albums that contain multiples of at least 1 Track 1 ★)
$noop(★ 0, They are Handled as InComplete ★)
$noop(★ 1  They are Handled as Complete w/starred but not Gold icon★)
$set(_extraTrackHandling,1)

$noop(★ 1  Earlier in the Sort Artist Diversion?★)
$set(_earlierLevelArtistSeparation,0)
$noop(★ 0  Earlier in the Sort Incomplete Diversion?★)
$set(_earlierPresortForIncompletes,1)

$noop(★ Do you want separation by type / extension at the Root Level? ★)
$noop(★ ~/Music/MP3/AlbumTitle/ - ~/Music/FLAC/AlbumTitle/ - ~/Music/M4A/AlbumTitle/ - ~/Music/WNA/AlbumTitle/ ★)
$set(_rootLevelTypeSeparation,0)   

$noop(★ Do you want separatation by type / extension at the Album Level? ★)
$noop(★ ~/Music/AlbumTitle/MP3/ - ~/Music/AlbumTitle/FLAC/ - ~/Music/AlbumTitle/M4A - ~/Music/AlbumTitle/WNA/ ★)
$set(_albumLevelTypeSeparation,1)

$noop(★ Do you want the Album Title added before the type / extension after the Album Level? ★)
$noop(★ ~/Music/AlbumTitle/AlbumTitle MP3/ - ~/Music/AlbumTitle/AlbumTitle FLAC/ - ~/Music/AlbumTitleAlbumTitle /M4A ★)
$set(_albumNameAtTypeSeparation,1)

$noop(Root Level Sort Against Select Genre Values.)
$noop(★ ~/Music/GenreSubSortDirectory/AlbumTitle/AlbumTitle MP3/Single/ - ~/Music/GenreSubSortDirectory/AlbumTitle/AlbumTitle FLAC/EP/ ★)
$set(_isSubSort,1)

$noop(Album Name/EP/Single/Live/Album etc.)
$noop(★ ~/Music/AlbumTitle/AlbumTitle MP3/Single/ - ~/Music/AlbumTitle/AlbumTitle FLAC/EP/ ★)
$set(_separateByTypeInArtistDirectory,1)

$noop(★ Do you want Tribute and Cover Albums Placed with Artist being attributed? ★)
$noop(★ ~/Music/AlbumTitle/AlbumTitle MP3/Cover/ - ~/Music/AlbumTitle/AlbumTitle FLAC/Tribute/ ★)
$noop(★ Requires coverTributeSort tag and albumartistsort Tags ★)
$noop(Set a coverTributeSort tag value of “Tribute” or “Cover”.)
$noop(Enter the associated Artist in the AlbumArtistSort as tag.)
$set(_altArtistSort,1)

$set(_separateAlbum,0) $noop(Albums in SubDirectory as well)
$noop(★ ~/Music/A/Artist/AlbumTitle, ~/Music/A/Artist/Albums/AlbumTitle ★)

$set(_showTrackArtistSeparation,0) $noop(Breakdown by Artist within Album ** Special Case Use / Usually Left Side Compilations)
$noop(★ ~/Music/A/Artist/AlbumTitle/Artist/Track, ~/Music/A/Artist/Albums/AlbumTitle/Artist/Track ★)

$set(_compilationsGSubDirectory,Compilations/)
$noop(★ ~/Music/Compilations/  ★)

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

$noop(★ Multi-Disc ★)

$noop(★ ~/Music/A/Artist, Music/AlbumTitle/Disc01/01 - Tracklist ★)
$set(_useSubDiscDirectory,1)

$noop(★ ~/Music/A/Artist, Music/AlbumTitle/01 - Tracklist ***SKIP SubDiscDirectory if only one Medium in Realease ★)
$set(_mergeDiscWhenNotUsingSubDirectory,0)

$set(_showDiscSubtitle,1)
$set(_nameForTypeCD,Disc)
$set(_nameForTypeVinyl,Side)

$noop(★ ~/Music/A/Artist, Music/AlbumTitle/A1 ,A2 ,B1, B2 Tracklist - ★)
$set(_useMusicBrainzStyleForVinylTrack,1)

$noop(★ Custom Subdirectory Titles at Artist Level ★)
$noop(★ ~/Music/A/Artist, Music/EP/AlbumTitle ~/Music/A/Artist, Music/Live/AlbumTitle ★)

$set(_albumSubDirectory,Albums/)
$set(_compilationsASubDirectory,Compilation/)
$set(_coverSubDirectory,Cover/)
$set(_tributeSubDirectory,Tribute/)
$set(_singlesSubDirectory,Singles/)
$set(_liveSubDirectory,Live/)
$set(_epSubDirectory,EP/)
$set(_broadcastSubDirectory,•Broadcast/)
$set(_interviewSubDirectory,Interview/)
$set(_videoSubDirectory,Video/)
$set(_otherSubDirectory,Others/)
$set(_dupesDirectory,• Duplicates/)
$set(_exportDirectory,• Exports/)
$set(_extDirectory,%_extension%/)
$set(_subSortGame,•Arcade/)
$set(_subSortDJBits,•DJBits/)
$set(_subSortClassical,Classical/)
$set(_subSortDemento,Dementia/)
$set(_subSort12Inch,•12 Inch Mix/)
$set(_subSortDisney,Disney/)
$set(_subSortPodcast,Podcast/)
$set(_subSortInterview,•Interview/)
$set(_subSortBroadcast,Broadcast/)
$set(_subSortReserved,•Singles Candidates/)
$set(_subSortPreTag,•No MBID/)
$set(_subSortHoliday,Holiday/)
$set(_subSortCountry,Country/)
$set(_subSortBlues,Blues/)
$set(_subSortJazz,Jazz/)
$set(_subSort2Oct,Spooktacular/)
$set(_subSort2Nov,Fallback/)
$set(_subSort2Dec,Here Comes Santa/)
$set(_subSort2Jan,Wintertime/)
$set(_subSort2Feb,Will You Be My Valentine?/)
$set(_subSort2Mar,Spring is in the Air/)
$set(_subSort2Apr,Foolish/)
$set(_subSort2May,Maybe/)
$set(_subSort2June,SumSumSummertime/)
$set(_subSort2July,Fireworks & Stuff/)
$set(_subSort2Aug,SumSumSummertime/)
$set(_subSort2Sept,SumSumSummertime/)

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

$noop(★ Detect Genre/SubSort Destinations ★)

$if($in(%genresort%,Holiday),$set(_subSortDirectory,%_subSortHoliday%))
$if($in(%genresort%,*-*),$set(_subSortDirectory,%_subSortReserved%))
$if($in(%genresort%,***),$set(_subSortDirectory,%_subSortPreTag%))
$if($in(%genresort%,Novelty),$set(_subSortDirectory,%_subSortDemento%))
$if($in(%genresort%,DJ Bits),$set(_subSortDirectory,%_subSortDJBits%))
$if($in(%genresort%,Humo),$set(_subSortDirectory,%_subSortDemento%))
$if($in(%genresort%,Demento),$set(_subSortDirectory,%_subSortDemento%))
$if($in(%genresort%,Comedy),$set(_subSortDirectory,%_subSortDemento%))
$if($in(%genresort%,FuMP),$set(_subSortDirectory,%_subSortDemento%))
$if($in(%genresort%,Game),$set(_subSortDirectory,%_subSortGame%))
$if($in(%genresort%,Disney),$set(_subSortDirectory,%_subSortDisney%))
$if($in(%genresort%,odcast),$set(_subSortDirectory,%_subSortPodcast%))
$if($in(%genresort%,nterview),$set(_subSortDirectory,%_subSortInterview%))
$if($in(%genresort%,roadcast),$set(_subSortDirectory,%_subSortBroadcast%))
$if($in(%genresort%,12 Inch),$set(_subSortDirectory,%_subSort12Inch%))
$if($in(%genresort%,Classical),$set(_subSortDirectory,%_subSortClassical%))
$if($in(%genresort%,Country),$set(_subSortDirectory,%_subSortCountry%))
$if($in(%genresort%,Spook),$set(_subSort2Directory,%_subSort2May%))
$if($in(%genresort%,Fall),$set(_subSort2Directory,%_subSort2Nov%))
$if($in(%genresort%,Summer),$set(_subSort2Directory,%_subSort2June%))
$if($in(%genresort%,Firew),$set(_subSort2Directory,%_subSort2July%))
$if($in(%genresort%,Fool),$set(_subSort2Directory,%_subSort2Apr%))
$if($in(%genresort%,Maybe),$set(_subSort2Directory,%_subSort2May%))
$if($in(%genresort%,Spring),$set(_subSort2Directory,%_subSort2Mar%))
$if($in(%genresort%,Santa),$set(_subSort2Directory,%_subSort2Dec%))
$if($in(%genresort%,Blues),$set(_subSortDirectory,%_subSortBlues%))
$if($in(%genresort%,Jazz),$set(_subSortDirectory,%_subSortJazz%))
$noop(####################### Scratch Space ######################)
$noop( )
$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 Live ★)
$if($in(%releasetype%,live),
  $set(_isLive,1)
)
$noop(★ Detect EP ★)
$if($in(%releasetype%,ep),
  $set(_isEP,1)
)
$noop(★ Detect Broadcast ★)
$if($in(%releasetype%,broadcast),
  $set(_isBroadcast,1)
)
$noop(★ Detect Interview ★)
$if($in(%releasetype%,interview),
  $set(_isInterview,1)
)
$noop(★ Detect Artist Compilation ★)
$if($in(%releasetype%,compilation),
  $set(_isArtistCompil,1)
)
$noop(★ Detect Audiobook ★)
$if($in(%releasetype%,audiobook),
  $set(_isAudiobook,1)
)
$noop(★ Detect Other ★)
$if($in(%releasetype%,other),
  $set(_isOther,1)
)
$noop(★ Detect Tribute ★)
$if($in(%coverTributeSort%,Tribute),
  $set(_isTribute,1)
)
$noop(★ Detect Cover ★)
$if($in(%coverTributeSort%,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 BitRate Split ★)
$if($in(%BitRateSplit%,Yes),
  $set(_addBitRate,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 Type ★)
$if($eq(%compilation%,1),
  $set(_isGlobalCompil,1)
)
$noop(★ Detect Global Compilation ★)
$if($eq(%_isGlobalCompil%,1), $set(_isArtistCompil,0)
)
$noop(★ Get Track Length ★)
$if($eq(%_showTime%,1),
  $set(_trackLength,%_length%)
)
$noop(★ Drop Unused Placeholder Tags ★)
$if($eq(%title%,Title),$delete(title)$delete(titlesort))
$if($eq(%subtitle%,Subtitle),$delete(subtitle))
$if($eq(%discsubtitle%,DiscSubtitle),$delete(discsubtitle))
$if($eq(%artists%,Artist;AdditionalArtists),$delete(artists))
$if($eq(%artistssortorder%,Artist),$delete(artistssortorder))
$if($eq(%album%,Album),$delete(album)$delete(albumsort)$delete(albumartistsort)$delete(albumartist))
$if($eq(%media%,Media),$delete(media))
$if($eq(%label%,Label),$delete(label))
$if($eq(%catalognumber%,Cat#),$delete(catalognumber))

$noop(########## Start File Naming Structure Variables ###########)
$noop(sorted by artist place holder)
$noop(•ByBitRate/%bitrate%)
$noop(★ Typography on file naming only ★)
$set(_titleForFilename,$if2(%titlesort%,%title%))
$set(_albumForFilename,$if2(%albumsort%,%album%))

$set(_discsubtitleForFilename,%discsubtitle%)
$set(_albumartistForFilename,$if2(%albumartist%,%artist%))
$set(_artistForFilename,%artist%)
$set(_albumartistsortForFilename,$if2(%albumartistsort%,%artistsort%,%artist%))
$set(_artistsortForFilename,$if2(%artistsort%,%artist%))

$noop(########## Start TAG Manipulation ##########################)
$noop(★ Organize artist by alphabetical Directories excluding leading The ★)
$set(albumartist,$if($eq($left(%albumartist%,4),The ),%albumartistsort%,%albumartist%))
$noop($set(undersc0riginalFileName,%_filename%))

$noop(########## Start TAG Formatting  ###########################)
$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(★ # ➡ ♯)
$set(_titleForFilename,$replace(%_titleForFilename%,#,♯))
$set(_albumForFilename,$replace(%_albumForFilename%,#,♯))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,#,♯))

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

$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(★ For Development Only - Variable Settings in Subsections ★)
$noop(★ Where Available - Audio Metrics Only at this Time ★)

$noop(########### Audio Metrics Setup  ###########################)
$noop(########### DevMode Values Only ############################)

$set(_devMode,0) $noop(Use Standin Data.)

$set(_biitrate,71.426)
$set(_saample_rate,44100)
$set(_biits_per_sample,16)
$set(_chaannels,2)
$set(_tiitle,My Great Score)
$noop(########### CONFIRM DevMode is Disabled for Live Use ########)

$noop(############## Determine Bit Rate Integer Value #############)

$if($eq(%_devMode%,1),FileBit %_biitrate% ---)

$if($eq(%_devMode%,1),$set(_intBitRate,$rreplace(%_biitrate%,\\.\\d*\$,)),$set(_intBitRate,$rreplace(%_bitrate%,\\.\\d*\$,)))

$if($eq(%_devMode%,1),IntBit %_intBitRate% ---)

$if($eq(%_devMode%,1),$set(_bitRateSpeed,%_saample_rate%KHz),$set(_bitRateSpeed,%_sample_rate%KHz))
$if($eq(%_devMode%,1),$set(_bitsPerSample,[%_biits_per_sample%]bit),$set(_bitsPerSample,[%_bits_per_sample%]bit))
$if($eq(%_devMode%,1),$set(_audioChannels,%_chaannels%ch),$set(_audioChannels,%_channels%ch))
$if($eq(%_devMode%,1),$set(_titleForFilename,%_tiitle%),$set(_titleForFilename,%title%))

$set(_bitRateType,$if($eq_any(%_intBitRate%,320,256,224,192,160,128,112,96,80,64,48,40,32,24,16,8),CBR$set(_cbrRateValue,%_intBitRate%)$set(_fileCBRRate,%_intBitRate%),VBR$set(_vbrRateValue,%_intBitRate%)))

$noop(Bitrate factors of 8.0 are most likely CBR with the remainder being VBR)

$if($eq(%_bitRateType%,VBR),
$if($gt(%_vbrRateValue%,339),$set(_fileVBRRate,320+),
$if($gt(%_vbrRateValue%,319),$set(_fileVBRRate,320),
$if($gt(%_vbrRateValue%,260),$set(_fileVBRRate,V0+),
$if($gt(%_vbrRateValue%,220),$set(_fileVBRRate,V0),
$if($gt(%_vbrRateValue%,191),$set(_fileVBRRate,V1),
$if($gt(%_vbrRateValue%,170),$set(_fileVBRRate,V2),
$if($gt(%_vbrRateValue%,150),$set(_fileVBRRate,V3),
$if($gt(%_vbrRateValue%,140),$set(_fileVBRRate,V4),
$if($gt(%_vbrRateValue%,130),$set(_fileVBRRate,V5),
$if($gt(%_vbrRateValue%,120),$set(_fileVBRRate,V6),
$if($gt(%_vbrRateValue%,95),$set(_fileVBRRate,V7),
$if($gt(%_vbrRateValue%,69),$set(_fileVBRRate,V8),
$if($gt(%_vbrRateValue%,44),$set(_fileVBRRate,V9),
$set(_fileVBRRate,%_intBitRate%)
))))))))))))))

$noop(######### File Naming Structure Variables Complete #########)

$noop(★ Pathname Generation Starts Here ★)

$noop(★ Root level Path ★)
$noop(   root = '/Volumes/Drive/Music/ ... [Destination Directory Setting])
$noop(   rootLevelExport Separation/%_exportssDirectory%/MP3/Artist/Album ...)
$if($eq(%_rootLevelExportsSeparation%,1),%_exportDirectory%,)

$noop(   rootLevelDuplicate Separation/%_dupesDirectory%/MP3/Artist/Album ...)
$if($eq(%_rootLevelDupeSeparation%,1),%_dupesDirectory%,)

$noop(★ Separate by Format at root directory ★)
$noop(   rootLevelPath/MP3/Artist/Album ...)
$if($eq(%_rootLevelTypeSeparation%,1),$upper(%_extension%),)

$noop(★ Separate by _setSubSort against Genre tag values ★)
$if($eq(%_isSubSort%,1),%_subSortDirectory%%_subSort2Directory%)

$noop(   Earlier Incomplete Separation for Sorting ...)
$if($eq(%_earlierPresortForIncompletes%,1),$if($eq($is_complete(),0),$if($lt($matchedtracks(),%_totalalbumtracks%),$if($and(%_isIncomplete%,$not($in(%SavePerfectAnyway%,yes))), - %_incompleteDirectory%,))),$if($and(%_isIncomplete%,$not($in(%SavePerfectAnyway%,yes))), - %_incompleteDirectory%,))
$if($in(%SaveIncompleteAnyway%,yes),%_incompleteDirectory%)/
$if($eq(%_earlierLevelArtistSeparation%,1),%_artistForFilename%/)

$noop(★ Soundtrack in custom directory ,after soundtracksDirectory?? ★)
$noop(   root/*/Audio Books/Title ...)
$noop(   root/*/Soundtracks/Title ...)
$noop(   root/*/Podcasts/Title ...)
$if(%_isSoundTrack%,%_soundTracksDirectory%$left($swapprefix($if2(%albumsort%,%album%),A,An,The),1)/,/
$if(%_isAudiobook%,%_audiobooksDirectory%$left($swapprefix($if2(%albumsort%,%album%),A,An,The),1)/,/)
$if(%_isPodcast%,%_podcastDirectory%$left($swapprefix($if2(%albumsort%,%album%),A,An,The),1)/,/)

$noop(★ Various in custom directory ★)
$noop(root/<*>/Various)
$if(%_isVarious%,%_variousArtistsDirectory%$left($swapprefix($if2(%albumsort%,%album%),A,An,The),1)/,/
	$if(%_isGlobalCompil%,%_compilationsGSubDirectory%$left($swapprefix($if2(%albumsort%,%album%),A,An,The),1)/,/)
	$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%),#1)),
	$if($eq(%_orderTypeForArtist%,2),$if(%_isGlobalCompil%,,$upper($firstalphachar($if2(%_albumartistsortForFilename%,%_artistsortForFilename%),#2)))
	)))/

$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(★ If Using Alternate Artists Directory For Covers & Tributes  **Uses Order for Album Artist tag ★)

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

	$noop(root/<*>/D/DEVO/[Covers]/Devolution)
	$if($eq_all(%coverTributeSort%,%_altArtistSort%,%_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(%_isEP%,1),%_epSubDirectory%,
							$if($eq(%_isSingle%,1),%_singlesSubDirectory%,
								$if($eq(%_isBroadcast%,1),%_broadcastSubDirectory%,
							   $if($eq(%_isInterview%,1),%_interviewSubDirectory%,
									$if($eq(%_isVideo%,1),%_videoSubDirectory%,
										$if($eq(%_isOther%,1),%_otherSubDirectory%,
											$if($eq(%_isAlbum%,1),
											$if($eq(%_separateAlbum%,1),%_albumSubDirectory%))

											)))))))))))))

$noop(root/<*>/B/B-52's, The]/Bouncing off the Satellites/ )
%_albumForFilename%
$noop(★ Bouncing off the Satellites [Media-Type]/ ★)
$noop($if($ne(%media%,CD),$if(%media%,[$rreplace(%media%,["″], Inch)])))
$if(%media%, [$title(%media%]),)

$noop($if($and(%media%,$ne(%media%,CD)),$if($in(%media%,Vinyl),$title( [%media%])),$upper( [%media%])))

$noop(★ Bouncing off the Satellites [Vinyl] [YEAR]/ ★)
$if($eq(%_showDate%,1),$if($if2(%date%,%originalyear%,%originaldate%), [$left($if2(%date%,%originalyear%,%originaldate%),4)],))
$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Release Status]/ ★)
$if(%releasestatus%,$if($eq(%_showReleaseStatus%,1),$title( [%releasestatus%])))

$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Official] [Label]/ ★)
$if(%label%,$if(%_showRecordLabel%, $if(%label%,$title([%label%]))))

$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Official] [MCA] [CAT-Number]/ ★)
$if(%catalognumber%,$if($eq(%_showCatalogueNumber%,1),$title( [%catalognumber%])))

$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Official] [MCA] [AB-DC001]/ ★)
$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Official] [MCA] [AB-DC001] - Incomplete/ ★)

$if($eq(%_extraTrackHandling%,1),$if($eq($is_complete(),0),$if($lt($matchedtracks(),%_totalalbumtracks%),$if($and(%_isIncomplete%,$not($in(%SavePerfectAnyway%,yes))), - %_incompleteDirectory%,))),$if($and(%_isIncomplete%,$not($in(%SavePerfectAnyway%,yes))), - %_incompleteDirectory%,)
)/
$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Official] [MCA] [AB-DC001]/ MP3 / ★)
$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Official] [MCA] [AB-DC001]/ Bouncing off the Satellites MP3 / ★) 

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

$noop(★ One Last Option to Sort By Author -within- a Left Side Album Compilation/ ★)
$if(%artist%,$if($eq(%_showTrackArtistSeparation%,1),$title(%artist%)))

$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Official] [MCA] [AB-DC001]/ .../ Disc # ★)
$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%))/

$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 ★)

$if($eq(%_quickNoNameFormat%,0),%_titleForFilename%,%_filename%)

$noop(★ Insert Coin for Extra Metrics ★)

[%_trackLength%]

$if($eq(%_quickNoNameFormat%,0),$if($eq(%_showBandwidth%,1),[%_fileCBRRate%%_fileVBRRate% %_bitRateSpeed% %_bitRateType% %_audioChannels%],$if($eq(%_showBandwidth%,1),[%_fileCBRRate%%_fileVBRRate% %_bitRateType%])))

$noop(★ 00 CREDITS ★)

Here’s the latest of this… I’ve been tied up on the FileMaker side of this project now… Darn you COVID hell… @carV3 @JusPow45

2 Likes

What can I say but WOW!!! :open_mouth:

I guess that 2.6c is a lot different than that one posted earlier. I know I did a lot of fine tuning in there before I got it to do darn near just about everything for me. Combined with using Keyboard Maestro (OS X Macro engine) and a whole mess of other scripts, the $Smart Title Case plugin that I cobbled together… and a few other tweaks in MBP like lots of columns.

It’s also just slightly more than 32000 characters which is the limit for individual posts on here. I had to nuke some comment lines to get it to post.

I’ll get back into more Picard in a bit…
This is great stuff. Python FTW. Now Qt OTOH, their UI implementation is still screwed up on OS X vs. Windows & Linux.


Thank you so much for the update. I’m not using your script as is but it’s greatly helping me break things down and customize my own which is based on the original and yours plus other snippets that others have posted. I feel I’m starting to get to grips with all this now. That’s mighty impressive stuff you have done there with breaking down the genres into sub categories.

Personally I am not a fan of sorting by alphanumeric characters and prefer Artist. I then I have my own custom genre directory’s on my NAS for example [Jazz Swing Funk], [Jazz Blues Rock] or [Pop Ambient Chillout] rather than rely on what a third party tagging system classes an album as and then drop artists/albums into what I feel is appropriate. The best thing your script has helped with is the breaking down of sub directories within the artist, Singles, Live, EP etc. This really helps with sorting things out before transferring across to my NAS.

The next thing for me is to try and work out is how to create a Classical directory alongside Various and Soundtracks to which I can then apply a $set(_isClassical,1) via tagger script so it drops the album in that directory rather than in Artists. Maybe it’s possible to change the releasetype to classical so it drops into a Classical directory.

I changed $noop( Order root by category ) to $if2(%albumgrouping%,Artists So without the LastFM plugin it’s Artists rather than Untitled.

Once again thanks for the update. It brings some some faith back to humanity when folks like us are willing to take time out to help each other out on forums like this.

:upside_down_face: This thread was the reason I managed to get that thing to do so much. It grew so far into niche functions for me vs. what a lot of others might want to do, but yeah, let’s let people discover from it just like I did at first too. :slight_smile:

1 Like

Just registered to say many many thanks! I appriciate your effort and time in doing this and sharing your code and github repo.

one thing to mention what mislead me by reading here - the discussion above and pasted code by @arielreyes001 in feb 20 is an 1 year older version of the script. there have been good and important fixes in the new version in feb 2020 of rdswift. (e.g.: autofill of track-digits caused me some hours digging for a fix - while this has been completely reworked by rdswift) :see_no_evil: :wink:

@rdswift: i have some questions in using the script. i want to organize my lib slightly diffrent but first want to understand your ideas behind.

  • you organize singles: /~ A ~/Album Artist/[~Singles~]/[year] Title [feat.]
    Whats the idea behind ungrouping singles. If I understand it correctly, you only create 1 [Singles] folder per Artist having year and title.
    but would it not make more sense to have the singles in yearly sperated folders like an album to keep the tracklist of a single ? e.g. the different singles of the same track in 1 year would be mixed in filestructure. or did i oversee s.th.?
  • i want to organize my files into different folders: keeping “Soundtracks | Artists(Albums+Singles) | Samplers (=Varius Artists) | …others formats” seperated. Best way would be adding a constant for “Music Artists” and hang in this one in the File path section I think?
  • I want to change the Artist in the Tracknames: instead of having the artist added in brackets at the End, i would love to have the oldschool format: Disc-Track Artist - Title [feat.] where your script is writing the arist into the Brackets . Can you give me a hint where deal with this without messing up some code parts with the feat. part ?
1 Like

Purely preference. If you want to do it some other way, go for it.

That simply creates a directory for each letter of the alphabet (and one for numbers, etc.) which contains all the artists starting with that letter. I find it a bit quicker to make a first selection from 27 directories, than it is to scroll through 500 or 600 artist directories. If you don’t want the grouping by first letter, then simply leave it out.

It’s in this section:

$noop(
########################################################################
#                                                                      #
#  Set File Name                                                       #
#                                                                      #
########################################################################
)
$if($eq(%_nAlbumType%,Classical),$set(_nFileName,%_nTNum%%_nFeat% %_nTNT%))
$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%))

It sounds like the format you want is something like:

$set(_nFileName,%_PaddedDiscNum%-%_PaddedTrackNum% %_nPTA% - %_nTN%%-nFeat%)
1 Like

Hi rdswift.
thank you for your help and so quick response (just some minutes after i posted my questions).
I was really happy when I was back home to immediately read your support and to start directly to change code and see results.

ha, I was just to deep inside reading it that I just thought its a special typo for s.th. right after writing I just figured it out myself by some tests runs at test folders. :man_facepalming: - then i changed my text above, but that was already too late, you just answered it.

:+1: perfect, that helped me directly to understand it much more and quicker. There was just a small misstyping at the end - the “dash” should be a lower dash/underscore:

After the correction it ran directly out of the box. This finally helped to to be sure where to change parts. And I finally did it :handshake: :smiley:


my changed code parts:

So what i finally did was chaning your code over the last days to get it working to a structure I would love to have:

  • at constants I introduced 2 more vars:
$set(_cMusicArtist,[Music Artists])
$set(_cUnknownSingle,[~Unknown Singles~]) 
  • at defaults if plugin is missing I added 1 more:
$set(_nSNT,$if2(%album%,%_cUnknownSingle%))

for the above code I have 2 questions:
1.would album or title be correct for %_nSNT% ? I am not really sure what is the correct field for the “title” of a Single. Seems it is same to track title - but I expect it could be different for maybe marketing things. So far i used %album%
2. _nAN, _nANT seem duplicates and _nAN is not used later. Same for _nTN,_TNT. Is this s.th. special or leftover code?


ok then back again to the changes:

  • at trim I took care to trim the new variable, too:
$if($gt($len(%_nSNT%),%_aTitleMaxLength%),$set(_nSNT,$left(%_nSNT%,$sub(%_aTitleMaxLength%,3))...))
  • then I ran into some problems at my albums recognizing singles and not mixing soundtracks to albums. I solved it by changing the code for both to:
$set(_t1,%_t1%$if($or($in(%_primaryreleasetype%,single),$in(%releasetype%,single)),Y,N))
$if($eq(%_t1%,1=YY),$set(_nAlbumType,Single))
#...and second block:
$set(_t2,%_t2%$if($or($in(%_secondaryreleasetype%,soundtrack),$in(%releasetype%,soundtrack)),Y,N))
$if($eq(%_t2%,2=Y),$set(_nAlbumType,Soundtrack))
  • for the filepath i changed it get the singles separated into a folder for each one and to prevent duplicated ones I added more single Info like media and satus and type. (thats maybe not finished yet, I am just playing around with this atm):
#set File Path (last 2 lines)
$if($eq(%_nAlbumType%,Single),$set(_nFilePath,%_cMusicArtist%/%_nPAAS%/%_cSingles%/%_nYear% %_nSNT% [%_nTotalTracks%tracks %media% %releasestatus% %releasetype%]/))
$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,%_cMusicArtist%/%_nFAAPS%/%_nYear% %_nANT%/)
))))
  • and finally for the filename i changed it according to rdswifts hint:
#  Set File Name                                                       
$if($eq(%_nAlbumType%,Soundtrack),$set(_nFileName,%_nTNum% %_nPTA% - %_nTN%$if($eq(%_nPTA%,%_nFTA%),,%_nFeat%)))
$if($eq(%_nAlbumType%,Single),$set(_nFileName,%_nTNum% %_nPTA% - %_nTN%$if($eq(%_nPTA%,%_nFTA%),,%_nFeat%)))
$if($eq(%_nAlbumType%,Standard),$set(_nFileName,%_nTNum% %_nPTA% - %_nTN%$if($eq(%_nPTA%,%_nFTA%),,%_nFeat%)))

The result is great!! I can just again say many thanks to you and sharing your experience.
I will further on refinde at the code when i ran it on more files and maybe I’ll find some more problems at the changed lines.

I hope it helps others if s.o. wants to change it and I can recommend reading the code and then try it on backuped examples - its really easy to see changes there.

1 Like

Great to hear that you’ve been able to use part of the script and adapt it to your needs, and expand it to get the desired results.

  1. I think I would use the track title because then it should still provide something in the event that you’re processing a non-album track / standalone recording. In fact, you can use both by adding the track title to your $if2 command as:
$set(_nSNT,$if2(%album%,%track%,%_cUnknownSingle%))
  1. Leftover code. I really should clean that up. :wink:
1 Like

Thanks, that is exactly what I was looking for.