I should start by saying I have virtually no experience with regexes, so crafting my own is a bit beyond me. I've been using this regex to rename my collection and replace invalid characters with underscores.
It's gone well except for a few tracks I have with an unusual format for their numbering scheme. The format is generally something like "01-01" (that's 2 sets of numbers, hyphenated) or "SP 01" (letters followed by number). This matches how the tracks are sold in groups, and I'd like to retain that numbering scheme. Just to be clear, the files are already tagged properly, I'm merely trying to get the filenames to match. Obviously the $num(%track%,2) part of the regex I've been using only returns numbers, however without it mp3tag wants to use "track number/total tracks" in the filename. The solution for avoiding this is to use $num(%track%,2) which obviously won't work in this case as I need non-numerical characters to be included.
Does anyone know how to get mp3tag to use whatever is in the tracknumber field, without adding the total tracks afterwards? I'd like it to work with the $validate(...,_) part as well. I don't think I need to use the $num(%track%,2) part to force initial 0's if I've somehow missed them in tagging, but if that could be included as well it would be nice just in case.
The function $num() transforms the given string into a number or everything from the start of the string until it finds something that is no number.
So, if you leave out the $num(%track%,2) and simply use %track% to generate the filename, everything should be fine.
If you already have leading zeros in the field TRACK then you would not need $num(%track%,2) anyway as that would not make any change.
This works for lossless files but doesn't seem to work properly for MP3's. Imgur: The magic of the Internet Image 1
The MP3's seem to report being tagged as track number/total tracks
However looking at it in foobar shows that TRACK is only the track number, and total tracks is separate
It seems this applies to MP3's using normal track numbers as well
Is this perhaps an issue with the way foobar tags things and the way mp3tag tags/reads them?
says %totaltracks% is the field, but this shows up as empty when I try to use it in mp3tag on both FLAC and MP3
Sorry, had to link to the imgur album since new users are limited to 2 links per post
MP3 files know only 1 field for the number:TRACK.
And that includes the total number of tracks, separated by a slash. That is how the standard describes it.
If you want to rename the files and they do not follow the same pattern, then it is easiest to apply filters
e.g. %track% HAS -
or %track% MATCHES [A-z]
and then treat all these special cases with a special pattern.