Repository for neat file name string patterns and tagger script snippets

Well here’s my current one, developed over the past 15 years or so:

$noop(<!-- MusicBrainz Picard Tagger script -->)
$noop(<!-- 2019-10-17 Version 0.11 by Moonbase -->)
$noop(<!-- You should have plugin lastfmng enabled and set up -->)
$noop(<!-- This script also works with Picard 2.x/lastfmng 2.x -->)

$noop(<!-- Remove "Various Artists" on compilations – good for Logitech Mediaserver/SqueezeCenter -->)
$noop(<!-- We use the MB albumartistid for identification because there IS an artist called "Various Artists" -Torsten Pröfrock- -->)
$if($and($eq(%compilation%,1),$eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377)),$unset(albumartist) $unset(albumartistsort))

$noop(<!-- Set Original Year and Decade to date of first known release -- instead of using the date of THIS release  -->)
$noop(<!-- Picard/Mutagen will automatically store originalyear as ID3v2.3 TORY [YYYY] or ID3v2.4 TDOR [YYYY-MM-DD], -->)
$noop(<!-- depending on which ID3v2 version is used. Additionally, a TXXX:originalyear tag gets saved for ID3v2,     -->)
$noop(<!-- respectively ORIGINALYEAR for OGG and FLAC files.                                                         -->)
$noop(<!-- Plugin lastfmng sets originaldate to the first known track release year from last.fm                      -->)
$if(%originaldate%,$set(originalyear,$left(%originaldate%,4)))
$noop(<!-- It may happen that we have NO originaldate from the plugin but originalyear from Picard, so base Decade on that -->)
$if(%originalyear%,$set(comment:Songs-DB_Custom1,$left(%originalyear%,3)0s))
$noop(<!-- Fallback: If we have originalyear BUT NOT originaldate, put the originalyear back into originaldate       -->)
$if($and(%originalyear%,$not(%originaldate%)),$set(originaldate,%originalyear%))

$noop(<!-- For a single track, if we couldn't find a grouping and/or genre, set it to the album's grouping and genre -->)
$if(%grouping%,,$setmulti(grouping,%albumgrouping%))
$if(%genre%,,$setmulti(genre,%albumgenre%))

$noop(<!-- Plugin lastfmng sets some album-related tags: we do not want these                           -->)
$unset(albumgenre)
$unset(albumgrouping)
$unset(albummood)
$unset(comment:Songs-DB_Occasion_album)
$unset(comment:Songs-DB_Custom1_album)
$unset(comment:Songs-DB_Custom2_album)
$unset(comment:Songs-DB_Custom3_album)
$unset(comment:Songs-DB_Custom4_album)

$noop(<!-- As workaround for ID3v2.3, store MOOD in TXXX:Mood, since we have no TMOO tag as in ID3v2.4 -->)
$if(%mood%,$set(~id3:TXXX:Mood,%mood%))

$noop(<!-- As workaround for ID3v2.3, store DISCSUBTITLE in TXXX:discsubtitle, since we have no TSST tag as in ID3v2.4 -->)
$if(%discsubtitle%,$set(~id3:TXXX:discsubtitle,%discsubtitle%))

$noop(<!-- Ambiguous album names: store MusicBrainz' _releasegroupcomment and use in file naming later on            -->)
$if(%_releasegroupcomment%,$set(releasegroupcomment,%_releasegroupcomment%))

$noop(<!-- Ambiguous track names: store MusicBrainz' _recordingcomment and use in file naming later on            -->)
$if(%_recordingcomment%,$set(recordingcomment,%_recordingcomment%))

File naming to go with it:

$if($and($eq(%compilation%,1),$or($eq(%albumartist%,),$eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377))),$if2(%artistsort%,%artist%)/$if2(%artistsort%,%artist%) - [compilations]/$if2(%artistsort%,%artist%) - %title%$if(%recordingcomment%, \(%recordingcomment%\)),$if2(%albumartistsort%,%albumartist%,%artistsort%,%artist%)/$if(%album%,$if2(%albumartistsort%,%albumartist%,%artistsort%,%artist%) - %album%$if(%releasegroupcomment%, \(%releasegroupcomment%\))$if(%date%%_primaryreleasetype%%_secondaryreleasetype%%releasecountry%, \()$if(%date%,$left(%date%,4))$if($and(%date%,%_primaryreleasetype%), )$if(%_primaryreleasetype%,%_primaryreleasetype%)$if($and(%date%%_primaryreleasetype%,%_secondaryreleasetype%),\, )$if(%_secondaryreleasetype%,%_secondaryreleasetype%)$if($and(%date%%_primaryreleasetype%%_secondaryreleasetype%,%releasecountry%),\, )$if(%releasecountry%,%releasecountry%)$if(%date%%_primaryreleasetype%%_secondaryreleasetype%%releasecountry%,\))/$if(%discsubtitle%,$if(%media%,%media% ,)$if(%discnumber%,%discnumber%: ,)%discsubtitle%/,),)$if2(%artistsort%,%artist%) - %title%$if(%recordingcomment%, \(%recordingcomment%\)))

I use fdemmer’s lastfmng plugin to get genres and some other stuff, so for completeness’ sake here is the plugin’s config.ini I use:


[global]
soundtrack_is_no_genre = True
ignore_feat_artists = False
; string used as fallback, when no tag value could be determined
default_unknown =
; this disables both album and track stats if set to False
print_tag_stats = True
print_tag_stats_album = True
print_tag_stats_track = False
; only enable collect_unused if you have sqlite (windows and macos may not)
collect_unused = False
lastfm_host = ws.audioscrobbler.com
lastfm_port = 443
; author's last.fm api key -- please use your own!
lastfm_key = REDACTED

[category-defaults]
; do/don't collect tags for that category
enabled = True
; a hard limit for how many tags are assigned to the metatag
limit = 5
; name of another category, unused tags in this category will be used in the given one.
overflow =
; add all tags from the other category to this one
prepend =
; used to join tags if >1 are to be used (None to use multtag)
separator =
; alphabetically sort tags before joining to string
sort = False
; percentage; only the tags with a score above x% of the most popular are used
threshold = 0.5
; apply titlecase() function to each tag
titlecase = True

[category-grouping]
# grouping is used as major/high level category
limit = 1
separator =
overflow = genre
metatag_track = grouping
metatag_album = albumgrouping

[category-genre]
limit = 5
threshold = 0.4
prepend = grouping
metatag_track = genre
metatag_album = albumgenre

[category-mood]
# eg. angry, cheerful, clam, ...
limit = 5
metatag_track = mood
metatag_album = albummood

[category-occasion]
# eg. background, late night, party
limit = 5
metatag_track = comment:Songs-DB_Occasion
metatag_album = comment:Songs-DB_Occasion_album

[category-category]
# i don't really know
limit = 5
metatag_track = comment:Songs-DB_Custom2
metatag_album = comment:Songs-DB_Custom2_album

[category-country]
# country names
limit = 2
threshold = 0.7
metatag_track = comment:Songs-DB_Custom4
metatag_album = comment:Songs-DB_Custom4_album

[category-city]
# city names
limit = 1
threshold = 0.7
metatag_track = comment:Songs-DB_Custom3
metatag_album = comment:Songs-DB_Custom3_album

[category-decade]
# musical era, eg. 80s, 90s, ...
limit = 1
threshold = 0.7
titlecase = False
metatag_track = comment:Songs-DB_Custom1
metatag_album = comment:Songs-DB_Custom1_album
regexp = ^([1-9][0-9])*[0-9]0s$

[category-year]
# the full year, eg. 1995, 2000, ...
# not recommended: let musicbrainz provide that
enabled = False
limit = 1
threshold = 0.7
titlecase = False
metatag_track = year
regexp = ^[1-9][0-9]{3}$


[searchlist]
;;; loosely based on the "standard" id3v1 genres
;;; #TODO i am not very happy with this. maybe the contemporary genres
;;;       list in wikipedia would be better as a basis for grouping.
grouping = Blues, Classic Rock, Country, Dance, Disco, Funk,
           Grunge, Hip-Hop, Jazz, Metal, New Age, Oldies, Pop,
           R&B, Rap, Reggae, Rock, Techno, Industrial, Alternative,
           Ska, Death Metal, Pranks, Soundtrack, Euro-Techno, Ambient,
           Trip-Hop, Vocal, Jazz+Funk, Fusion, Trance, Classical,
           Acid, House, Game, Sound Clip, Gospel, Noise,
           Alternative Rock, Bass, Soul, Punk, Space, Meditative,
           Instrumental Pop, Instrumental Rock, Ethnic, Gothic, Darkwave,
           Techno-Industrial, Electronic, Pop-Folk, Eurodance, Dream,
           Southern Rock, Comedy, Cult, Gangsta,
           Pop/Funk, Jungle, Native US, Cabaret, New Wave, Psychadelic,
           Rave, Showtunes, Trailer, Lo-Fi, Tribal, Acid Punk, Acid Jazz,
           Polka, Retro, Musical, Rock & Roll, Hard Rock, Folk,
           Folk-Rock, National Folk, Swing, Fast Fusion, Bebob, Latin,
           Revival, Celtic, Bluegrass, Avantgarde, Gothic Rock,
           Progressive Rock, Psychedelic Rock, Symphonic Rock, Slow Rock,
           Big Band, Chorus, Easy Listening, Acoustic, Humour, Speech,
           Chanson, Opera, Chamber Music, Sonata, Symphony, Booty Bass,
           Primus, Porn Groove, Satire, Slow Jam, Club, Tango, Samba,
           Folklore, Ballad, Power Ballad, Rhytmic Soul, Freestyle, Duet,
           Punk Rock, Drum Solo, Acapella, Euro-House, Dance Hall, Goa,
           Drum & Bass, Club-House, Hardcore, Terror, Indie,
           Polsk Punk, Beat, Heavy Metal,
           Black Metal, Crossover,
           Merengue, Salsa, Trash Metal, Anime, Synthpop

;;; genre should not also contain tags from grouping or you'll get duplicates!
genre = soundtrack, score, Instrumental, hair metal,
    2 tone, a cappella, abstract hip-hop, acid, acid jazz,
    acid rock, acid house, acoustic guitar, acoustic rock, adult alternative,
    adult contemporary, alternative country, alternative folk,
    alternative metal, alternative pop, alternative rock, anti-folk, aor, austropop, britpop,
    art rock, atmospheric, aussie hip-hop, avant-garde, ballads, baroque, beach,
    beats, bebop, big band, big beat, blaxploitation, blue-eyed soul, bluegrass, blues
    rock, boogie rock, boogie woogie, bossa nova, breakbeat, breaks, brit pop,
    brit rock, british invasion, broadway, bubblegum pop, cabaret, calypso, cha
    cha, choral, christian rock, classic country, classical guitar, club,
    college rock, composers, contemporary classical, contemporary country, contemporary folk, country
    folk, country pop, country rock, crossover, dance pop, dancehall, dark
    ambient, darkwave, delta blues, dirty south, disco, doo wop, doom metal,
    downtempo, dream pop, drum and bass, dub, dub reggae, dubstep, ebm, east coast
    rap, easy listening, edm, electric blues, electro, electro pop, elevator music,
    emo, emocore, ethnic, eurodance, europop, experimental, fingerstyle, folk
    jazz, folk pop, folk punk, folk rock, folksongs, free jazz, french rap,
    funk metal, funk rock, fusion, g-funk, gaelic, gangsta rap, garage,
    garage rock, glam rock, goa trance, gospel, gothic, gothic metal, gothic
    rock, gregorian, groove, guitar, happy hardcore, hard rock,
    hardcore, hardcore punk, hardcore rap, hardstyle, heavy metal, honky tonk,
    horror punk, house, humour, hymn, idm, indie folk, indie pop, indie rock,
    industrial, industrial metal, industrial rock, instrumental
    hip-hop, instrumental rock, j-rock, jangle pop, jazz fusion, jazz
    vocal, jungle, latin, latin jazz, latin pop, lounge, lovers rock, lullaby,
    madchester, mambo, medieval, melodic rock, minimal, minimalism, modern country, modern
    rock, mood music, motown, ndw, ndh, neo-soul, new age, new romantic, new wave, noise,
    northern soul, nu-metal, oi, old school rap, opera, orchestral, philly soul,
    piano, political reggae, polka, pop life, pop punk, pop rock, pop soul, post
    punk, post rock, power pop, progressive, psychedelic,
    psychedelic folk, psychedelic punk, psychedelic rock, psychobilly,
    psytrance, quiet storm, r&b, ragga, rap, rap metal, reggae pop,
    reggae rock, rnb, rock and roll, rock opera, rockabilly, rocksteady, roots, roots
    reggae, rumba, salsa, samba, schlager, screamo, shanty, shock rock, ska punk,
    smooth jazz, soft rock, southern rock, space rock, speech, spoken word, standards,
    stoner rock, surf rock, swamp rock, swing, symphonic metal, symphonic rock,
    synth pop, synthpop, tango, techno, teen pop, thrash metal, traditional country,
    traditional folk, tribal, turntablism, underground, underground
    hip-hop, underground rap, urban, vocal trance, waltz, west coast rap,
    western swing, world, world fusion, power metal, alternative punk,
    post punk, folktronica, glam, folk metal, viking metal, progressive metal,
    downbeat, groovesalad, post grunge, christian, classic metal, melodic metal,
    j-pop, j-rock, neoclassical, composer, symphonic, speed metal, post metal

mood = angry, bewildered, bouncy, calm, cheerful, chill, cold,
       complacent, crazy, crushed, cynical, dark, dramatic, dreamy, drunk,
       eclectic, emotional, energetic, envious, feel good, flirty, funky, groovy,
       happy, haunting, healing, high, hopeful, hot, humorous, inspiring, intense,
       irritated, laidback, lonely, lovesongs, meditation, melancholic, melancholy,
       mellow, moody, morose, passionate, peace, peaceful, playful, pleased,
       positive, quirky, reflective, rejected, relaxed, retro, sad, sentimental,
       sexy, silly, smooth, soulful, spiritual, suicidal, surprised, sympathetic,
       trippy, upbeat, uplifting, weird, wild, yearning, catchy, nostalgic,
       heartbreaking, lovely, depressive, cool, slow, sweet, soft, fun, heavy,
       cheap, fast

occasion = background, birthday, breakup, carnival, chillout,
           christmas, death, dinner, drinking, driving, graduation, halloween, hanging
           out, heartache, holiday, late night, love, new year, party, protest, rain,
           rave, romantic, sleep, spring, summer, sunny, twilight, valentine, wake up,
           wedding, winter, work, xmas

category = animal songs, amazing, awesome, attitude, autumn, b-side, ballad,
           banjo, bass, beautiful, body parts, bootlegs, brass, cafe del mar, chamber
           music, clarinet, classic, classic tunes, compilations, covers, cowbell,
           deceased, demos, divas, dj, drugs, drums, duets, field recordings, female,
           female vocalist, film score, flute, food, genius, girl group, great lyrics,
           guitar solo, guitarist, handclaps, harmonica, historical, horns, hypnotic,
           influential, insane, jam, keyboard, legends, life, linedance, live, loved,
           lyricism, male, male vocalist, masterpiece, melodic, memories, musicals,
           nostalgia, novelty, number songs, old school, oldie, oldies, one hit
           wonders, orchestra, organ, parody, poetry, political, promos, radio
           programs, rastafarian, remix, samples, satire, saxophone, showtunes,
           sing-alongs, singer-songwriter, slide guitar, solo instrumentals,
           speech, stories, strings, stylish, synth, top 40, traditional,
           trumpet, unique, unplugged, violin, virtuoso, vocalization, vocals,
           cover, epic, best of

;;; #TODO translate countries. eg. icelandic -> iceland
country = african, american, arabic, australian, austrian,
          belgian, brazilian, british, canadian, caribbean, celtic, chinese, cuban,
          danish, dutch, eastern europe, egyptian, estonian, european, finnish,
          french, german, greek, hawaiian, ibiza, icelandic, indian, iranian, irish,
          island, israeli, italian, jamaican, japanese, korean, mexican, middle
          eastern, new zealand, norwegian, oriental, polish, portuguese, russian,
          scandinavian, scottish, southern, spanish, swedish, swiss, thai, third
          world, turkish, welsh, western, texas, uk, belgium, england, scotland,
          usa, suomi, germany, austria, finland, icelandic

city = acapulco, adelaide, amsterdam, athens, atlanta,
       atlantic city, auckland, austin, bakersfield, bali, baltimore, bangalore,
       bangkok, barcelona, barrie, beijing, belfast, berlin, birmingham, bogota,
       bombay, boston, brasilia, brisbane, bristol, brooklyn, brussels, bucharest,
       budapest, buenos aires, buffalo, calcutta, calgary, california, cancun,
       caracas, charlotte, chicago, cincinnati, cleveland, copenhagen, dallas,
       delhi, denver, detroit, dublin, east coast, edmonton, frankfurt, geneva,
       glasgow, grand rapids, guadalajara, halifax, hamburg, hamilton, helsinki,
       hong kong, houston, illinois, indianapolis, istanbul, jacksonville, kansas
       city, kiev, las vegas, leeds, lisbon, liverpool, london, los angeles,
       louisville, madrid, manchester, manila, marseille, mazatlan, melbourne,
       memphis, mexico city, miami, michigan, milan, minneapolis, minnesota,
       mississippi, monterrey, montreal, munich, myrtle beach, nashville, new
       jersey, new orleans, new york, new york city, niagara falls, omaha, orlando,
       oslo, ottawa, palm springs, paris, pennsylvania, perth, philadelphia,
       phoenix, phuket, pittsburgh, portland, puebla, raleigh, reno, richmond, rio
       de janeiro, rome, sacramento, salt lake city, san antonio, san diego, san
       francisco, san jose, santiago, sao paulo, seattle, seoul, shanghai,
       sheffield, spokane, stockholm, sydney, taipei, tampa, tijuana, tokyo,
       toledo, toronto, tucson, tulsa, vancouver, victoria, vienna, warsaw,
       wellington, westcoast, windsor, winnipeg, zurich

; add words (in uppercase!) that should be kept uppercase by titlecase
abbreviations = USA, UK, EBM, EDM, IDM, NDW, NDH, R&B, AOR


[translations]
; <name1> is translated into <name2>
acoustic guitar = guitar
ambient piano = piano
brit pop = britpop
chill out = chillout
depressed = depressive
deutsch = german
dnb = drum and bass
drum 'n' bass = drum and bass
drum n bass = drum and bass
electronica = electronic
english = england
female vocalists = female vocalist
hip hop = hip-hop
hiphop = hip-hop
jpop = j-pop
jrock = j-rock
male vocalists = male vocalist
melancholic = melancholy
nu metal = nu-metal
post-grunge = post grunge
post-metal = post metal
post-punk = post punk
post-rock = post rock
prog rock = progressive rock
relax = relaxed
relaxing = relaxed
rock 'n' roll = rock & roll
rock and roll = rock & roll
rock n roll = rock & roll
rock'n'roll = rock & roll
rnb = r&b
sex = sexy
trip hop = trip-hop
minimalist = minimalism
modern classical = contemporary classical
soundtracks = soundtrack
speeches = speech
00s = 2000s
10s = 2010s
20s = 1920s
30s = 1930s
40s = 1940s
50s = 1950s
60s = 1960s
70s = 1970s
80s = 1980s
90s = 1990s

It will sort each and everything under the (album) artist sort names. Titles picked up from compilation samplers are stored in a special subfolder albumartistsort - [compilations]. The script uses release group comments to differentiate between albums of the same name (Peter Gabriel, Weezer, Elis, …), adds a release year, album type and release country in parentheses and disambiguates tracks of the same name by their recording comments (adding things like (live, 1990-03_ Billboard The Venue, Melbourne, Australia) to the track filename to avoid things like title (1).flac, title (2).flac.


(Disregard the sole [compilations] folder, that was accidentally generated with an older script version.)

The year shown in the album folder name is the release year, the country the release country, so I can distinguish releases with the same name.

Oh, and there are no track numbers because I’m interested in the title and not their storage location on a particular medium. There is also some intended redundancy (repeated artist names) because the album and track artists can be different.

This structure makes me happy when travelling: It’s much easier copying stuff together onto a USB drive or SD card and still know which title is which. I was so fed up with USB sticks containing a hundred entries starting with 01. … and no artist name

6 Likes

I’ve updated the MBP YA Magic-Script that does more stuff too to v1.9.

If there are no values within the brackets, they will not show at all. (So, no more [ ] [ ] empties)
Re-organized the Settings section.
Cleared up the examples and documentation a bit.
…and put in some “Earlier in the Sort…” options for re-directing stuff while organizing.
To use those on and off, you’d have to go into the Options and change the values as needed when saving various sets of files.

3 Likes

@tdiaz Great Update, big Improvements!

…and It’s 2.0 now, it does what I want, it’s been taken apart function by function.

Gone through, line by line and the CBR/VBR section has been fixed up a lot.

I had some squirrelly voodoo going on with the File Metrics being created. It was probably a combination of things script wise and pre-processed file wise.

With “Ignore Tags” set, to where I’m just over-riding the two I use within the script for special album placement, it’s all good!

I had some cross-use of %_underScore% vs %noUnderScore% so some tags were getting created and then that was having an affect on anything that already had and MBID …and the unintended tags.

Sorry for clogging up the thread … :slight_smile:

Now I’ll go mess with the Python for a bit … and see what I come up with.

2 Likes

I just wanted to share that I updated my script to v2.0 if interested check it out. And once again thanks the all the people who help me out within this board, it’s like school for me I just keep on learning from the great teachers who dwell here!

1 Like

EDIT: I found a serious misplaced parenthesis error in my script. It was causing soundtracks to become completely messed up. I’ve replaced it below with my corrected version.

I rewrote my script to make it a little more compact. I used to have a lot of repeated code, but now I pulled the common code out of the $if statements and consolidated it.

I also added a feature I just discovered to clean up my folder names. I added some scripts to set control variables and then my naming script adds some disambiguating elements to file names only where necessary.

I have a couple versions of the same release, and I was using release comments to keep them in separate folders. The unfortunate side effect of this was presence of release comments on releases where I didn’t need them. Now I can designate only certain releases to add the release comment to the folder name, while all the rest are unaffected. Since variables are written to the files as tags, I only have to designate the release once, and it will always use the alternate naming script.

In this test, you can see the AKB48 single has it’s release comments (Type-A, Type-B) in the folder name, while the Rush album doesn’t. Kate Bush’s Cloudbusting single now has it’s media type in the folder name, but none of the other albums do.

In the Scripting tag, I added the following lines, each in it’s own script:

$set(usereleasecomment,1)
$set(usemediatype,1)
$delete(usereleasecomment)
$delete(usemediatype)

I also have a common script that’s set to run automatically.

$if($gt(%_totalalbumtracks%,99),$set(tracknumber,$num(%tracknumber%,3)),$set(tracknumber,$num(%tracknumber%,2)))

My full naming script is:

$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(%compilation%,
		$noop(Various artist albums)
		Various Artists/~
		$left($swapprefix(%album%,A,An,The),1)~/$swapprefix(%album%,A,An,The),
		$noop(Normal albums)
		~$left($if2(%albumartistsort%,%artistsort%,%albumartist%,%artist%),1)~/
		$if2(%albumartistsort%,%artistsort%,%albumartist%,%artist%)/%album%))
	$noop(Common path)
	$if(%usereleasecomment%,$if(%_releasecomment%, \(%_releasecomment%\)))
	$if(%usemediatype%,$if(%media%, \(%media%\)))
	$if($in(%releasetype%,single), \(Single\))
	$if($in(%releasetype%,ep), \(EP\))/
	$if($gt(%totaldiscs%,1),%discnumber%)
	$if($gt(%_totalalbumtracks%,99),$num(%tracknumber%,3),$num(%tracknumber%,2)) - %artist% - %title%
,*,[x])
,?,)
,:,-)
,",')
,<,{)
,>,})
4 Likes

I was playing around a little just to satisfy myself as to what would really work for me as a script. Came up with this in two days may have a bug here and there but I thought maybe it would help someone out who doesn’t understand the tagger-script language and needed a pretty cool script. This script goes about 3 layers deep but it has lots of info for each album. Like I said there is a chance it may have a few errors but overall not too bad, feel free to play with it if you like.

$if($inmulti(%releasetype%,soundtrack),Soundtrack,$swapprefix($if2(%_artists_album_primary_std%,%artist%),The,Die,Le))
/$if2(%originalyear%,$left(%originaldate%,4),$left(%date%,4),0000) - %album%
$if($eq(%releasestatus%,promotion), [Promo],)
$if($eq(%releasestatus%,bootleg), [Bootleg],)
$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(%date%,[$left(%date%,4)] ,----)
$if(%media%,[$title(%media%)] ,)
$if($gt(%totaldiscs%,1),[%totaldiscs%CD] ,)
$if(%label%,$title([%label%])
$if(%catalognumber%,$title([%catalognumber%]))
$if(%releasecountry%, [%releasecountry%]))
/$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)

Results:
masterpiece

1 Like

A post was split to a new topic: Help with finding or making tagger script to handle (feat. …)

Here is my final version:

$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($and(%_multiartist%,$or(%compilation%,%_artists_album_additional_id%)),%artist% - ,)$truncate(%title%,70)

Last edit: HERE
Full info: HERE

Result:

2 Likes

I Just made an alternate script I like to borrow ideas and see what I can come up with. It has similarities to my other script but it puts albums into folder categories like Studio albums, Live albums, singles, etc…
of course, as usual, there may be an issue somewhere or there but overall it’s working pretty good!

The Script:

$if($gt(%_bits_per_sample%,16),-=[%_bits_per_sample%bit]=-,)/
$upper(%_extension%)/
$if2($if($eq($len(%musicbrainz_albumid%),0),No MBID/$if2(%albumartist%,%artist%),)/
$if($and($lt($matchedtracks(),%totaltracks%),$lt($matchedtracks(),60)),Incomplete Releases/$if2(%albumartist%,%artist%),$if2(Artists/$if2(%albumartist%,%artist%)))/
$if($eq(%releasetype%,album; soundtrack),Soundtracks/,)
$if($eq(%releasestatus%,promotion),Promo's/,)
$if($eq(%releasestatus%,bootleg),Bootlegs/,)
$if($eq(%releasetype%,album),Studio Albums/,
$if($eq(%releasetype%,single),Singles/,
$if($eq(%releasetype%,ep),EP's/,
$if($inmulti(%releasetype%,soundtrack),OST/,
$if($inmulti(%releasetype%,live),LIVE/,
$if($inmulti(%releasetype%,compilation),Compilations/,
$if($eq(%releasetype%,album; soundtrack),Soundtracks/,))))))))
$replace($replace($rreplace($if($not($inmulti(%releasetype%,soundtrack)),$if($eq(%albumartist%,Various Artists),VA,%albumartist%)-)%album%,[_:*?"<>|], -),?,), ,_)
$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),-\(CDMaxi\)-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($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%CD,),)
$if($ne(%_extension%,mp3),$upper(-%_extension%))
$if($if2(%date%,%originalyear%,%originaldate%),-$left($if2(%date%,%originalyear%,%originaldate%),4), [0000])-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),CD$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)

Results:
result

If you like this script give me some likes, please. If there are issues feel free to correct them and let others know. I spend way too much time playing with tagger script and you would think I would be a little better with it by now. Anyway, maybe it will help somebody out there!

1 Like

Fine Tuning and a little house cleanup v2.1

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%)/
$if2($if($eq($len(%musicbrainz_albumid%),0),No MBID/$if2(%albumartist%,%artist%),)
,$if($eq(%releasetype%,album; soundtrack),Soundtracks/,)
,$if($and($or($eq(%releasetype%,album; compilation),$or($eq(%releasetype%,album),$eq(%releasetype%,compilation))),$eq(%albumartist%,Various Artists)),Compilations/,)
,$if($in(%album%,Promo Only),Promo Only/,)
$set(_albumartistprefix,$rsearch(%albumartist%,^\(The|A\)\\s+))
,$if($and($lt($matchedtracks(),%totaltracks%),$lt($matchedtracks(),60)),Incomplete Releases/$if2(%albumartist%,%artist%),$if(%_albumartistprefix%,$rreplace(%albumartist%,^\(%_albumartistprefix%\)\(.*\),\\2 \(\\1\)),%albumartist%)))/
$replace($replace($rreplace($if($not($inmulti(%releasetype%,soundtrack)),$if($eq(%albumartist%,Various Artists),VA,%albumartist%)-)%album%,[_:*?"<>|], -),?,), ,_)
$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),-\(CDMaxi\)-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($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),-[PS3-SACD],)
$if($eq(%media%,DVD-Audio),-[DVD-A],)
$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%CD,),)
$if($ne(%_extension%,mp3),$upper(-%_extension%))
$if($if2(%date%,%originalyear%,%originaldate%),-$left($if2(%date%,%originalyear%,%originaldate%),4), [0000])-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),CD$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)

Results:
Annotation 2020-01-17 214818

2 Likes

tdiaz thanks so much for your time and sharing your script. It is doing basically exactly what I have been looking for. I made a small tweak to the file naming to get [Year] ahead of the album name but other than this code is the bees knees.

Out of curiosity, are you revisiting or planning to expand code section re:bit rates for files in excess of 320? I’d love to add in higher bit rates for lossless audio but not sure where to start.

Thanks again!

Hello all,

I know very little about scripting, so I have two scripts that I copied from the old thread, in the old forum that was perfect for my needs. It’s been doing an excellent job for years but I need help in modifying it for a new “need” lol. As a result I have two questions:

1- Back then I copied a script for Single Artists, and another for Various Artists. Do we still need two separate ones? Basically, what I do is paste the “Various Artists” script whenever I’m tagging that type of album, the rest of the time I just have the “Single Artist” Script. Is there a way to incorporate both into one so that I don’t have to keep copying and pasting?

2- I would now like the script to treat Soundtracks differently. If it’s a soundtrack release type then I would like it placed in a folder called “[Soundtrack]”. Currently, my Various Artists script places the album in a “[Various Artists]” folder, so I would like the same thing, but for soundtracks. If it’s not a soundtrack then it would simply go in “[Various Artists]” as it has been doing.

To reiterate, the two questions are: Can I combine them? and how can I separate the Soundtracks from all other Various Artists releases?

Here are the two scripts:

Single Artists:

$rreplace($replace($replace($replace($replace($replace($replace($replace(
$if2(%albumartistsort%,%artist%)/%albumartist% - 
$if(%originaldate%,[$left(%originaldate%,4)]) %album%
$if($eq(%releasetype%,ep),[EP]) 
$if($eq(%releasetype%,single),[Single]) / 
$if($gt(%totaldiscs%,1),%discnumber%-,)$num(%tracknumber%,2)
$if(-%compilation%, - %artist%) - %title%
,?,),_,-),*,x),:,-),",),|, ),<,[),>,])

Various Artists:

$rreplace($replace($replace($replace($replace($replace($replace($replace(
$if2([Various Artists])/
$if(%date%,[$left(%date%,4)]) %album%
$if($eq(%releasetype%,ep),[EP])
$if($eq(%releasetype%,single),[Single])/ 
$if($gt(%totaldiscs%,1),%discnumber%-,)$num(%tracknumber%,2)
$if(-%compilation%, - %artist%) - %title%
,?,),_,-),*,x),:,-),",),|, ),<,[),>,])

In the end a soundtrack would look something like this:
\Music\[Soundtrack]\[1995] The Karate Kid - Original Movie Soundtrack\10 - Joe Esposito - You're the Best.mp3.
While any other Various Artists release would like this:
\Music\[Various Artists]\[1996] Pure Disco\05 - Gloria Gaynor - I Will Survive.mp3
The Single Artists would not change either. It would look like this:
\Music\Aaliyah\Aaliyah - [2002] I Care 4 U\02 - Aaliyah - Are You That Somebody.mp3

Thank you all for any help, I would greatly appreciate it!

The script that I use automatically processes soundtracks and singles differently, as well as Various Artists, and a few other things. It’s a bit lengthy (because I haven’t gone in an optimized it yet), but I’ve written and heavily commented it such that it should be easy to follow and pick pieces from or customize to fit your needs. It basically creates all the various “elements” of the path and file name, and then assembles them to meet the appropriate release criteria. If you have any questions, please just ask.

$noop(
#######################################################################
#
#  Picard File Naming Script                               2019-01-31
#  Bob Swift [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/tree/2.0_RDS_Plugins
#
#  For tagging and filing classical music using the Classical file
#  naming scheme, a user script must be enabled that sets the
#  _isClassical processing flag.
#
#  Additional variables provided are:
#
#  Album Variables
#  
#      _artists_album_primary_id - The ID of the primary / first album artist listed
#      _artists_album_primary_std - The primary / first album artist listed [standardized]
#      _artists_album_primary_cred - The primary / first album artist listed [as credited]
#      _artists_album_primary_sort - The primary / first album artist listed [sort name]
#      _artists_album_additional_id - The IDs of all album artists listed except for the primary / first artist, separated by a semicolon and space
#      _artists_album_additional_std - All album artists listed [standardized] except for the primary / first artist, separated with strings provided from the release entry
#      _artists_album_additional_cred - All album artists listed [as credited] except for the primary / first artist, separated with strings provided from the release entry
#      _artists_album_all_std - All album artists listed [standardized], separated with strings provided from the release entry
#      _artists_album_all_cred - All album artists listed [as credited], separated with strings provided from the release entry
#      _artists_album_all_sort - All album artists listed [sort names], separated with strings provided from the release entry
#      _artists_album_all_sort_primary - The primary / first album artist listed [sort name] followed by all additional album artists [standardized], separated with strings provided from the release entry
#      _artists_album_all_count - The number of artists listed as album artists
#  
#  Track Variables
#  
#      _artists_track_primary_id - The ID of the primary / first track artist listed
#      _artists_track_primary_std - The primary / first track artist listed [standardized]
#      _artists_track_primary_cred - The primary / first track artist listed [as credited]
#      _artists_track_primary_sort - The primary / first track artist listed [sort name]
#      _artists_track_additional_id - The IDs of all track artists listed except for the primary / first artist, separated by a semicolon and space
#      _artists_track_additional_std - All track artists listed [standardized] except for the primary / first artist, separated with strings provided from the track entry
#      _artists_track_additional_cred - All track artists listed [as credited] except for the primary / first artist, separated with strings provided from the track entry
#      _artists_track_all_std - All track artists listed [standardized], separated with strings provided from the track entry
#      _artists_track_all_cred - All track artists listed [as credited], separated with strings provided from the track entry
#      _artists_track_all_sort - All track artists listed [sort names], separated with strings provided from the track entry
#      _artists_track_all_sort_primary - The primary / first track artist listed [sort name] followed by all additional track artists [standardized], separated with strings provided from the track entry
#      _artists_track_all_count - The number of artists listed as track artists
#
#######################################################################
)

$noop(Test Values
   $set(_outputpath,PATH)
   $set(_outputfilename,FILENAME)
)


$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(_cClassical,[Classical])
$set(_cSoundtrack,[Soundtracks])
$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(
#######################################################################
#
#  RegEx Constants
#
#######################################################################
)
$set(_reCaseInsensitive,\(?i\))


$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),%_nDiscNum%-,)$num(%_nTrackNum%,2))


$noop(
#######################################################################
#
#  Set Album Type [Single, Soundtrack, Classical or Standard]
#
#  Process as Classical
#	Format: /[Classical]/Album Artist/[year] Album/Disc-Track [Composer] Title
#
#  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]
#
#######################################################################
)
$noop($if($and($lte(%_nTotalDiscs%,1),$lte(%_nTotalTracks%,1),$in(%_primaryreleasetype%,single)),$set(_nAlbumType,Single)))
$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))

$noop($if($and($eq($if2(%_nAlbumArtistID%,%_cVariousArtistID%),%_cVariousArtistID%),$in(%_secondaryreleasetype%,soundtrack)),$set(_nAlbumType,$if2(%_nAlbumType%,Soundtrack))))
$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))


$noop($set(_nYear,%_nYear% [%_t1%\,%_t2%]))


$if(%_isClassical%,$set(_nAlbumType,$if2(%_nAlbumType%,Classical)))
$set(_nAlbumType,$if2(%_nAlbumType%,Standard))


$noop(
#######################################################################
#
#  Set File Path
#
#######################################################################
)
$if($eq(%_nAlbumType%,Classical),$set(_nFilePath,%_cClassical%/%_nFAAPS%/%_nYear% %_nANT%/))
$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%,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%))

$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(
#######################################################################
#
#  Note that some of these replacements revert back to an underscore
#  because of processing for Windows compatability.
#
#######################################################################
)
$noop(
$set(_fnAlbumArtist,$rreplace(%_fnAlbumArtist%,/,•))
$set(_fnAlbumArtist,$rreplace(%_fnAlbumArtist%,:,ː))
$set(_fnAlbumArtist,$rreplace(%_fnAlbumArtist%,[.]3,…))
$set(_fnAlbumArtist,$rreplace(%_fnAlbumArtist%,[.]2_,…))
$set(_fnAlbumArtist,$rreplace(%_fnAlbumArtist%,[._]*\$,))
$set(_wAlbum,$rreplace(%_wAlbum%,:,ː))
$set(_wAlbum,$rreplace(%_wAlbum%,/,•))
$set(_wAlbum,$rreplace(%_wAlbum%,[._]*\$,))
$set(_wTitle,$rreplace(%_wTitle%,:,ː))
)


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

$noop(
$set(OutputPath,%_nFilePath%)
$set(OutputFileName,%_nFileName%)
)

$rreplace(%_nFilePath%/%_nFileName%,[?*:\\_]+,_)

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

Hi!

Thanks for the quick reply and for lending out your script.

It looks like it mostly formats the way I would like except for the standard (and singles) type. I don’t like to have my artists separated by letter. It seems all I have to do is remove the %_nInitial% from the script. But the thing I noticed as soon as I pasted it into musicbrainz was that the Year is not being populated. See the attached photo… any suggestions?
Script YR missing

Also, if there is more than one disk I’d like the sic number at the beginning of the file name to be padded. Where would I need to make that change?

Thanks again!

After testing it out I noticed that even though it shows up that way in the Picard preview it still works as intended and adds the year to the file when it renames and saves the file (my apologies for not testing!). After testing a couple of files I did notice something. Here’s an example of an album I have: Classics for Lovers, which is a compilation of different classical songs and composers so it is a “Various Artists” Release. Is it possible to modify the scripts so that an album such is this not placed under Various Artists but rather under the “Classical” type instead? When I ran your script it still placed it under Various Artists… so if it’s possible where would I make the change?

It’s possible to process the release as “Classical” as explained in the comments in the file itself:

#  For tagging and filing classical music using the Classical file
#  naming scheme, a user script must be enabled that sets the
#  _isClassical processing flag.

This would require the creation of a one-line script (under the “scripting” section) containing $set(_isClassical,1). Then simply enable the script before you load a release that you want processed as classical. Note that the default resulting format will be:

#  Process as Classical
#	Format: /[Classical]/Album Artist/[year] Album/Disc-Track [Composer] Title

For anything more extensive, I strongly recommend that you look into the “Classical Extras” plugin by @MetaTunes, which will provide access to much more information.

1 Like

Good morning!

Just want to thank you again for all your help!

When I first read that in the comments of the script I did not understand it, so thank you for explaining it :smiley: I have now been able to set it to fit my needs exactly. I don’t think I’ll ever have a set with more than 9 disks so even if the disk numbers aren’t padded it’s no big deal. In such exceptions I can always pad them myself with batch file renamers and such, so not important. I LOVE not having to switch between Various and Single artist releases anymore, this script is great!

Thanks again for everything @rdswift nad to the whole community!

1 Like

Here’s a small change that should take care of that for you automatically:

$noop(
-----------------------------------------------------------------------
-  Automatically pad disc and track numbers to the length of the total
-  number of discs and tracks.
-----------------------------------------------------------------------
)
$set(_PaddedDiscNum,$num($if2(%discnumber%,1),$len($if2(%totaldiscs%,1))))
$set(_PaddedTrackNum,$num($if2(%totaltracks%,1),$len($if2(%totaltracks%,1))))
1 Like

Wow thanks for that!

I just added it to between setting the file path and setting the file name sections and it didn’t work. The files were renamed as before. Where should I place it?