Tags and file naming scripts

so am i correct in saying there is a certain section in a file naming script that deals only with the tags and has nothing to do with the folder structure (naming of the folders and file) that will be applied on save?

because there is a ginormous difference between this script:

$if2(%albumartist%,%artist%)/
$if(%albumartist%,%album%/,)
$if($gt(%totaldiscs%,1),%discnumber%-,)
$if($and(%albumartist%,%tracknumber%),$num(%tracknumber%,2) ,)
$if(%_multiartist%,%artist% - ,)
%title%

and this insane script:

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

$noop(β˜… GLOBAL β˜…)
$set(_separateByTypeInArtistFolder,1)
$set(_separateAlbum,0)
$set(_useMusicBrainzStyleForVinylTrack,1)

$noop(β˜… Multi-Disc β˜…)
$set(_useSubDiscFolder,1)
$set(_mergeDiscWhenNotUsingSubfolder,0)
$set(_showDiscSubtitle,1)
$set(_nameForTypeCD,CD)
$set(_nameForTypeVinyl,Disc)

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

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

$noop(β˜… CUSTOM SUBFOLDER BY TYPE β˜…)
$set(_albumSubFolder,Albums/)
$set(_liveSubFolder,Lives/)
$set(_singlesSubFolder,Singles/)
$set(_epSubFolder,EP/)
$set(_broadcastSubFolder,Broadcast/)
$set(_otherSubFolder,Others/)

$noop(β˜… COMPILATION FOLDER [NO VARIOUS] β˜…)
$set(_compilationsSubFolder,Compilations/)

$noop(β˜… SOUNDTRACK/VARIOUS FOLDER β˜…)
$set(_soundTracksFolder,SoundTracks/)
$set(_variousArtistsFolder,Various/)

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


$noop(########## PATH SAMPLE [with defaults settings] ############)

$noop(β˜… 1st level β˜…)
$noop(~/Music/SoundTracks)
$noop(~/Music/Various)
$noop(~/Music/Category)

$noop(β˜… 2nd level β˜…)
$noop(~/Music/SoundTracks/Album name - 2016 [Vinyl])
$noop(~/Music/Various/Album name - 2016 [Vinyl])
$noop(~/Music/Category/Artist, The)

$noop(β˜… 3rd level β˜…)
$noop(~/Music/SoundTracks/Album name - 2016 [Vinyl]/CD1~subtitle)
$noop(~/Music/Various/Album name - 2016 [Vinyl]/CD1~subtitle)
$noop(~/Music/Category/Artist, The/Compilations)
$noop(~/Music/Category/Artist, The/Singles)
$noop(~/Music/Category/Artist, The/EP)
$noop(~/Music/Category/Artist, The/Album name - 2016 [Vinyl])
in this script
$noop(β˜… 4th level β˜…)
$noop(~/Music/SoundTracks/Album name - 2016 [Vinyl]/CD1~subtitle/01. Track.flac)
$noop(~/Music/Various/Album name - 2016 [Vinyl]/CD1~subtitle/01. Track.flac)
$noop(~/Music/Category/Artist, The/Compilations/Album name - 2016 [Vinyl])
$noop(~/Music/Category/Artist, The/Singles/Album name - 2016 [Vinyl])
$noop(~/Music/Category/Artist, The/EP/Album name - 2016 [Vinyl])
$noop(~/Music/Category/Artist, The/Album name - 2016 [Vinyl]/CD1~subtitle)

$noop(β˜… 5eme level β˜…)
$noop(~/Music/Category/Artist, The/Compilations/Album name - 2016 [Vinyl]/CD1~subtitle)
$noop(~/Music/Category/Artist, The/Singles/Album name - 2016 [Vinyl]/CD1~subtitle)
$noop(~/Music/Category/Artist, The/EP/Album name - 2016 [Vinyl]/CD1~subtitle)
$noop(~/Music/Category/Artist, The/Album name - 2016 [Vinyl]/CD1~subtitle/01. Track.flac)

$noop(β˜… 6eme level β˜…)
$noop(~/Music/Category/Artist, The/Compilations/Album name - 2016 [Vinyl]/CD1~subtitle/01. Track.flac)
$noop(~/Music/Category/Artist, The/Singles/Album name - 2016 [Vinyl]/CD1~subtitle/01. Track.flac)
$noop(~/Music/Category/Artist, The/EP/Album name - 2016 [Vinyl]/CD1~subtitle/01. Track.flac)


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

$noop(β˜… Detect Album β˜…)
$if($in(%releasetype%,album),
  $set(_isAlbum,1)
)

$noop(β˜… Detect Single β˜…)
$if($in(%releasetype%,single),
  $set(_isSingle,1)
)

$noop(β˜… Detect EP β˜…)
$if($in(%releasetype%,ep),
  $set(_isEP,1)
)

$noop(β˜… Detect Broadcast β˜…)
$if($in(%releasetype%,broadcast),
  $set(_isBroadcast,1)
)

$noop(β˜… Detect Other β˜…)
$if($in(%releasetype%,other),
  $set(_isOther,1)
)

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

$noop(β˜… Detect Live β˜…)
$if($in(%releasetype%,live),
  $set(_isLive,1)
)

$noop(β˜… Detect Soundtrack β˜…)
$if($in(%releasetype%,soundtrack),
  $set(_isSoundTrack,1)
)

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

$noop(β˜… Re-detect Compilation β˜…)
$if($eq(%compilation%,1),
  $set(_isGlobalCompil,1)
)


$noop(########## TAG MANAGE ######################################)

$noop(β˜… Organize artist by alphabetical folders excluding leading The β˜…)
$set(albumartist,$if($eq($left(%albumartist%,4),The ),%albumartistsort%,%albumartist%))


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

$noop(β˜… Typography for tags: changes will affect tags on media β˜…)

$noop(β˜… ... ➑ …)
$set(album,$replace(%album%,...,…))
$set(title,$replace(%title%,...,…))
$set(discsubtitle,$replace(%discsubtitle%,...,…))

$noop(β˜… No. ➑ β„–)
$set(album,$replace(%album%, [Nn]o.\\s*\(\\d\), β„–\\1))
$set(title,$rreplace(%title%, [Nn]o.\\s*\(\\d\), β„–\\1))
$set(discsubtitle,$replace(%discsubtitle%, [Nn]o.\\s*\(\\d\), β„–\\1))

$noop(β˜… [digit]" ➑ [digit]β€³)
$set(album,$rreplace(%album%,\(\\d\)",\\1β€³))
$set(discsubtitle,$rreplace(%discsubtitle%,\(\\d\)",\\1β€³))

$noop(β˜… "something" ➑ β€œsomething”)
$set(albumartist,$rreplace(%albumartist%,"\(.*?\)",β€œ\\1”))
$set(artist,$rreplace(%artist%,"\(.*?\)",β€œ\\1”))
$set(albumartistsort,$rreplace(%albumartistsort%,"\(.*?\)",β€œ\\1”))
$set(artistsort,$rreplace(%artistsort%,"\(.*?\)",β€œ\\1”))
$set(album,$rreplace(%album%,"\(.*?\)",β€œ\\1”))
$set(title,$rreplace(%title%,"\(.*?\)",β€œ\\1”))
$set(discsubtitle,$rreplace(%discsubtitle%,"\(.*?\)",β€œ\\1”))


$noop(β˜… Typography on file naming only β˜…)

$set(_titleForFilename,%title%)
$set(_albumForFilename,%album%)
$set(_discsubtitleForFilename,%discsubtitle%)
$set(_albumartistForFilename,%albumartist%)
$set(_artistForFilename,%artist%)
$set(_albumartistsortForFilename,%albumartistsort%)
$set(_artistsortForFilename,%artistsort%)

$noop(β˜… # ➑ β™―)
$set(_titleForFilename,$replace(%_titleForFilename%,#,β™―))
$set(_albumForFilename,$replace(%_albumForFilename%,#,β™―))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,#,β™―))

$noop(β˜… : ➑ ∢)
$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(########## RENAMER CORE ####################################)

$noop(β˜… Soundtrack in custom directory β˜…)
$if(%_isSoundTrack%,%_soundTracksFolder%,

  $noop(β˜… Various in custom directory β˜…)
  $if(%_isVarious%,%_variousArtistsFolder%,

    $noop(β˜… Order root by category β˜…)
    $if($eq(%_orderTypeForRoot%,1),
      $if2(%albumgrouping%,Unknown)
    )/

    $noop(β˜… Order root by artist β˜…)
    $if($eq(%_orderTypeForRoot%,2),
      $if($eq(%_orderTypeForArtist%,1),
        $upper($firstalphachar($if2(%_albumartistForFilename%, %_artistForFilename%),#)),
      $if($eq(%_orderTypeForArtist%,2),
        $upper($firstalphachar($if2(%_albumartistsortForFilename%, %_artistsortForFilename%),#))
      ))
    )/

    $noop(β˜… Artist with first letter of first name β˜…)
    $if($eq(%_orderTypeForArtist%,1),
      $if2(%_albumartistForFilename%,%_artistForFilename%)
    )/

    $noop(β˜… Artist with first letter of last name β˜…)
    $if($eq(%_orderTypeForArtist%,2),
      $if2(%_albumartistsortForFilename%,%_artistsortForFilename%)
    )/

    $noop(β˜… Organize by type β˜…)
    $if($eq(%_separateByTypeInArtistFolder%,1),
      $if($or(%_isArtistCompil%,%_isGlobalCompil%),%_compilationsSubFolder%,
        $if($eq(%_isLive%,1),%_liveSubFolder%,
          $if($eq(%_isAlbum%,1),
            $if($eq(%_separateAlbum%,1),%_albumSubFolder%)
          )
          $if($eq(%_isSingle%,1),%_singlesSubFolder%)
          $if($eq(%_isEP%,1),%_epSubFolder%)
          $if($eq(%_isBroadcast%,1),%_broadcastSubFolder%)
          $if($eq(%_isOther%,1),%_otherSubFolder%)
        )
      )
    )
  )
)

$noop(β˜… Album - YEAR [Media-Type][CDx~subtitle]/ or /CDx~subtitle/ β˜…)
%_albumForFilename% - 

$if($if2(%date%,%originalyear%,%originaldate%),$left($if2(%date%,%originalyear%,%originaldate%),4),0000)
$if($ne(%media%,CD), $if(%media%,[%media%]))

$if($gt(%totaldiscs%,1),$noop(
  )$if($lt(%totaldiscs%,10),$set(_discnumber,%discnumber%),$set(_discnumber,$num(%discnumber%,2)))$noop(
  )$if($in(%media%,Vinyl),$noop(
    )$set(_nameForDiscFolder,@OSLASH@@OBRACKET@%_nameForTypeVinyl%%_discnumber%@CBRACKET@),$noop(
    )$set(_nameForDiscFolder,@OSLASH@@OBRACKET@%_nameForTypeCD%%_discnumber%@CBRACKET@))$noop(
    )$if($and(%_discsubtitleForFilename%,$eq(%_showDiscSubtitle%,1)),$set(_nameForDiscFolder,%_nameForDiscFolder%~%_discsubtitleForFilename%))$noop(
    )$if($eq(%_useSubDiscFolder%,1),$noop(
      )$set(_nameForDiscFolder,$replace(%_nameForDiscFolder%,@OSLASH@@OBRACKET@,/))$noop(
      )$set(_nameForDiscFolder,$replace(%_nameForDiscFolder%,@CBRACKET@,)),$noop(
      )$if($eq(%_mergeDiscWhenNotUsingSubfolder%,1),$noop(
        )$unset(_nameForDiscFolder),$noop(
        )$set(_nameForDiscFolder,$replace(%_nameForDiscFolder%,@OSLASH@@OBRACKET@,[))$noop(
        )$set(_nameForDiscFolder,$replace(%_nameForDiscFolder%,@CBRACKET@,]))$noop(
      ))$noop(
    ))$noop(
    )$if(%_nameForDiscFolder%, %_nameForDiscFolder%)
)/

$noop(β˜… Track. Title β˜…)
$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(%_useSubDiscFolder%,0),$eq(%_mergeDiscWhenNotUsingSubfolder%,1)),%discnumber%))$num(%tracknumber%,2). )
)
%_titleForFilename%

if i use the first script, will that only set the tags for β€˜albumartist’, β€˜artist’, β€˜totaldiscs’, β€˜discnumbers’, β€˜tracknumbers’ and β€˜title’ since those are the variables used? and if i use the second script, a hell of a lot more tags will be named like β€˜release year’ and β€˜type of release’.
And if all that is true, then what part of the second script is dealing with the tags and what part is dealing with the naming of the folders and file? because to the average person, both of those scripts accomplish the same thing but ideally you would want more tags named so you can search for something specific if you need to. im just wondering why someone would go through so much trouble to produce nearly 300 more lines of code to basically end up exactly where you would be had you used the first script.

No, the file naming scripts only deal with the naming of the folders and files. If you want to manipulate the tags before saving you can use a tagger script in Options > Scripts for that.

About the difference of the two scripts, the second scripts adds more information to the folder and file names, such as medium format, year, disc subtitles and more. It also adds subfolders for release types (Albums, Singles, …), puts Soundtracks into a separate folder etc. For the details you need to check the plugin in detail or ask the authors of the plugins, I only looked quickly over it and didn’t try it.

1 Like

oh dang so if i want to have my files loaded with lots of tags i need to do that in the tagger script section? is it a good thing to have lots of tags or should i go for minimal?
i still can’t believe that whole script gets done the same thing as 5 lines of code, i get that it comes with settings and options but still. someone needs to make a GUI or a drop down menu where people can select how they want there id3 tags displayed

By default Picard writes most of the tags that CA be filled from MB already.

There are a couple of variables that might provide additional data that could be used for custom tags, see Basic Variables β€” MusicBrainz Picard v2.10 documentation and Advanced Variables β€” MusicBrainz Picard v2.10 documentation . Plugins might also add additional tags or variables.

If you want to limit the tags Picard writes you can e.g. do this with a script and the $unset function. There are a couple of threads here in the forums about this.

The two scripts you posted generate different file and folder names.

1 Like