103 in filename = CD1 Track 3, 212 in filename = CD2 Track 12

The format of some of my files are DTT where D = disc number and TT = track number. Now can I set the tags based on this portion of the filename. The general format is DTT - artist - title.mp3.

Thanks

1 Like

That’s possible, but you’ll need two steps to accomplish that. In general if you want to use the file name to generate tags you use Tags From File Names in the Tools menu. But this won’t be able to split your disc and track numbers, so we need to use some scripting afterwards.

First select the files you want to extract the tags for and choose Tools > Tags From File Names. As the pattern enter %_number% - %artist% - %title%. You can use the Preview button to see the result and apply it with Ok. As a result artist and title should be set properly. For now the leading number, the DTT, just got set as a variable. We’ll come back to that in the next step.

Now we need a script. Add a new script in Options > Scripting with the following content:

$set(discnumber,$left(%_number%,1))
$set(tracknumber,$right(%_number%,2))

Give the script some recognizable name (e.g. “Split DTT number”) . I’d also recommend to set it to deactivated so it does not run automatically on all matched files on the right.

Now save the options, select the files again for which you already extracted the tags, right click on them and choose Run scripts > “Split DTT number” (or whatever name you gave the script. The disc and track number tags should now have the proper value.

In the future you can do this conversion for all files by first applying Tags From File Names and then running the script.

7 Likes

Just for the record:
This becomes tricky if your format is DDTT or DTTT.
For example if you have a collection of more then 10 CDs and/or more then 99 Tracks (as in Top 150 compilations).

If you try to split
1101 it is not obvious if this should be CD1 with track number 101 or CD 11 with track 01.

It becomes even more confusing, if the format is only TTT.
If you try to recognize
101
it could be the track 101 (from your 150 total tracks)
(or it could be CD1 with track 01
or it could be CD10 with track 1.)

@thomasbihn So please be careful with your renaming script.

3 Likes

I appreciate the thoughtful responses. Thanks!

2 Likes