Standardize Track Numbers
Posted: 08 Jul 2021 08:29
Since I posted that last, I thought I'd post this too. It's pretty straightforward, but handy. This standardizes track numbers to two digits, padded, with a dot space on the end. If there are three or four digits, it assumes a CD was present and puts it in ##-##dotspace. It cleans off old formatting from a variety of different formats, e.g. #1), 1-, etc. It's not for every track list, but it does well with most. I left in a debugging variable if you want to see previews before each change, or make changes yourself.
Another approach, if it's really messy, is just clean everything off the front that isn't a number, then renumber it all. Or another, take the metadata track number and use disc number? and track number. But this gives very consistent results, is very fast, and it works on search lists, e.g. .flac for a big CD set with indifferently standardized tracks, but with track numbers present.
Again, it's in the form I use for a multiscript.
Another approach, if it's really messy, is just clean everything off the front that isn't a number, then renumber it all. Or another, take the metadata track number and use disc number? and track number. But this gives very consistent results, is very fast, and it works on search lists, e.g. .flac for a big CD set with indifferently standardized tracks, but with track numbers present.
Again, it's in the form I use for a multiscript.
Code: Select all
"Standardize Number: # ## ### #### ##-## #-## not beyond 99||| : Std#"
//This standardizes numbers for most music tracks. For 3 and 4 digit numbers, it assumes the first one or two are a CD that belongs before a dash.
//So don't use it if you really want ###dotspace padded, or whatever, i.e. past 99
//Numbers are standardized to: (##-)?##dotspace. Zeros are added for single digits on either of the two halves of the possible dash and CD number.
$debugPreview = ""; //or "p" if you want a preview.
rename r, "^# > ", "$debugPreview"; //Removes initial '#'. Just one.
rename r, "^(\d+)[ .](\d+)([^\d\-].+) > $1$2$3", "$debugPreview"; //Removes any space or dot between initial numbers. Just one.
rename r, "^[\(\[]?((?:[\d\-]{0,4}\d)|(?:[A-Z]\d))[\)\]]?[^A-Z\d\(\[\{]*(.+) > $1. $2", "$debugPreview"; //Clean, add dot space.
rename r, "^(\d)(\. .+) > 0$1$2", "$debugPreview"; //# to 0#; ## OK.
rename r, "^(\d)(\d\d\. .+) > 0$1-$2", "$debugPreview"; //### to 0#-##
rename r, "^(\d\d)(\d\d\. .+) > $1-$2", "$debugPreview"; //#### to ##-##
rename r, "^(\d)-(\d\d) > 0$1-$2", "$debugPreview"; //#-## to ##-##
rename r, "^(\d)-(\d\. .+) > 0$1-0$2", "$debugPreview"; //#-# to 0#-0#