I'm trying to make MP3Tag automatically generate the discnumber field based on the folder structure. Can anyone help me out? I have very limited scripting knowledge - so I'm confused as to where I should even start...
I'd like MP3Tag to recognize if there is a folder in the parent directory named "CD1", "CD2", "CD3", etc., to automatically create a x/x tag in the discnumber field, correctly tagging which directory it is in - and generate a discnumber total.
Also - if there isn't - I would like it to tag 1/1 for the discnumber.
Since these albums make up a small percentage of my library, I just tag them manually. What I've found is that if you load up the whole album (all discs) Mp3tag will sort them quite nicely and it makes it easy to select all files on disc 1 and give them DISC and DISCC tags (what I use for Flac), then all files from the disc 2, etc. And since the majority of my multidisc sets are two discs, I've created two actions called 'Disc 1 of 2' and 'Disc 2 of 2' that can handle 99% of the cases.
It would still be nice to have a way to automatically generate the '2' in the above example, the only thing I've been able to think of so far (using existing functionality) is to export a simple text file and read it back in as a taglist.
I have a function that does that (need to change it to a RegExp), but when the expression runs you don't know if you are on the last directory or not, so the result would always be 1/1, 2/2 , 3/3, 4/4. You'd need to capture the largest number and go back and update the other tracks.
Create an actiongroup 'Set DISCNUMBER step 2 (n/2)'
Action type:ReplaceField:DISCNUMBEROriginal:xReplace with:2[ ] only as whole word
[ ] case-sensitive comparison
Select all the tracks from album1 and run actiongroup 'Set DISCNUMBER step 1 (n/x)'.
Select all the tracks from album1 and run actiongroup 'Set DISCNUMBER step 2 (n/2)'.
You may create some more actiongroups of type 'step 2' with replacement numbers of 3 or 4 or what you want:
'Set DISCNUMBER step 2 (n/3)'.
'Set DISCNUMBER step 2 (n/4)'.
This is the half automatic way to work around the problem.
It will be better to have a full automatic solution, ...
but therefore we need an extra storage place to hold a user defined value while an action runs against the selected tracks, something like we know from the Mp3tag export section:
An action that can accept user input on runtime would be nice too.
Well, I know, that the problem is not solved in general so far (we really need a ready made Discnumber Assistant), but now we have a practical way to handle cases like ...
If there is no folder 'CDn' between album and file:
If there are two folders 'CDn' between album and file:
... by using this
Action #1: Action type:Format value Field:DISCNUMBER Formatstring:$if($eql($regexp(%_directory%,'^.* (CD) \d+.$','$1',0),'CD'),$regexp(%_directory%,'^. CD 0(\d+).$','$1',0)'/2','1/1')
If there is only one folder 'CD1' between album and file:
you can simply set DISCNUMBER to '1/1' by
Action #1: Action type:Format value Field:DISCNUMBER Formatstring:1/1