Last active
February 12, 2021 12:59
-
-
Save jbtyndall/8f9eb729fc211ca7ac3768c4a1ec042f to your computer and use it in GitHub Desktop.
MusicBrainz Picard Renaming Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$noop( ============================================ ) | |
$noop( === Artist/AlbumArtist overly long fixes === ) | |
$noop( ============================================ ) | |
$noop( # if AlbumArtist is very long, but Artist is shorter, swap them: ) | |
$if($gt($len(%albumartist%),64),$set(_toolong,$if($gt($len(%albumartist%),$len(%artist%)),%artist%))) | |
$noop( # if there are > 3 commas, semicolons, underscores, or ampersands, set to Various Artists: ) | |
$if($or($gt($lenmulti($if2(%_toolong%,%albumartist%,%artist%),;),3),$gt($lenmulti($if2(%_toolong%,%albumartist%,%artist%),\,),3),$gt($lenmulti($if2(%_toolong%,%albumartist%,%artist%), _ ),3),$gt($lenmulti($if2(%_toolong%,%albumartist%,%artist%), & ),3)),$set(_toolong,Various Artists)) | |
$noop( ======================================== ) | |
$noop( === Subfolders: 999, #, A-Z, VA, OST === ) | |
$noop( ======================================== ) | |
$set(_cleanartist,$swapprefix($if2(%_toolong%,%albumartistsort%,%artistsort%),A,An,The,Le)) | |
$set(_firstletter,$left(%_cleanartist%,1)) | |
$if($eq_any(%_firstletter%,0,1,2,3,4,5,6,7,8,9),$set(_subfolder,999)) | |
$if($eq($if2(%_toolong%,%albumartist%),Various Artists),$set(_subfolder,Compilations)) | |
$if($in($lower(%_secondaryreleasetype%),soundtrack),$set(_subfolder,Soundtracks)) | |
$if($not(%_subfolder%),$set(_subfolder,$firstalphachar(%_cleanartist%))) | |
$if($not($eq_any($left(%_subfolder%,1),9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z)),$set(_subfolder,#)) | |
$noop( =============================================== ) | |
$noop( === Media Type simplification/normalization === ) | |
$noop( =============================================== ) | |
$if($eq_any(%media%,Compact Disc,Copy Control CD,Data CD,DTS CD,Enhanced CD,HDCD,8cm CD,Blu-spec CD,SHM-CD,HQCD,CD+G,8cm CD+G),$set(_source,CD)) | |
$if($eq_any(%media%,7" Vinyl,10" Vinyl,12" Vinyl,Flexi-disc,7" Flexi-disc),$set(_source,Vinyl)) | |
$if($eq_any(%media%,DVD-Audio,DVD-Video),$set(_source,DVD)) | |
$if($eq_any(%media%,Hybrid SACD,Hybrid SACD \(CD layer\),Hybrid SACD \(SACD layer\),SHM-SACD),$set(_source,SACD)) | |
$if($eq(%media%,Digital Media),$set(_source,WEB)) | |
$if($and($not(%_source%),$ne(%media%,Unknown Format)),$set(_source,%media%)) | |
$noop( ==== Consistent four-digit [original] years === ) | |
$set(_date,$left($if2(%originalyear%,%date%),4)) | |
$noop( ==== 441000 / 1000 = 44... Sigh. ==== ) | |
$set(_sampleratecalc,$div(%_sample_rate%,1000)) | |
$if($eq(%_sampleratecalc%,44),$set(_sampleratecalc,44.1)) | |
$if(%_subfolder%,%_subfolder%/) | |
$if2(%_toolong%,%albumartistsort%,%artistsort%)/ | |
$if(%_date%, %_date%) - %album% {%date%$if(%label%, %label%)$if(%catalognumber%, %catalognumber%)$if(%releasecountry%,\, %releasecountry%)}$if(%_source%, [%_source%]) [$upper(%_extension%)]/ | |
$if($gt(%totaldiscs%,1),%_source% $num(%discnumber%,2)/$num(%tracknumber%,2). %title%,$num(%tracknumber%,2). %title%) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment