[X] %track% format string bug

Hi there!

There is an annoying bug in MP3Tag: Some MP3 files in the Track-Number tag have values like 1/21, 2/21, 3/21 etc. So now, when I make a Tag-Filename action (rename the MP3 files according to their tags) the %track% format string results to: 121, 221, 321 etc. But instead it should result to 01, 02, 03 etc. I.e., the %track% format string should consider only the number BEFORE the slash!

BTW, thank you to the authors for this very useful program!

In your format string ...
instead of %TRACK%



Hi Detlev, thank you for the hint, this works.

However, also without the $num function MP3Tag should consider only the characters before the slash. It does not make any sense at all to have the %TRACK% format string resolve to something like 321.

It does:

%track% = 3/21

/ is a invalid character for filenames in Windows. So Mp3tag does not write it and you get "321" in a filename.


$validate(%track%,_) = 3_21
$replace(%track%,/,⁄) = 3⁄21
$num(%track%,1) = 3
$num(%track%,2) = 03
$num(%track%,3) = 003
$num(%track%,2) of $regexp(%track%,.+/,) = 03 of 21

There is already some sense implemented.

If there is the value given "3/21" in the tag-field TRACK, then Mp3tag uses this value, why not?
So you can copy or append or prepend or insert this value to some other tag-field or put it into a text file by a Mp3tag report file.

When using the value "3/21" to create a file name or folder name, Mp3tag automatically removes such characters, which are forbidden to use for names in the file system, so the value will be changed to "321".

In the given limits you can control the validating to your own needs by using the function
See Mp3tag manual.

See also ...
[F] $validate() broken?

On the other hand you can provide the tag-field TRACK without the total tracks part.
Simply use two separate tag-fields TRACK=3 ... and ... TOTALTRACKS=21.

Use function $num(,) to format the track number ...


Use function $num(,) to format the number of total tracks ...


If needed, then build a format string of both components ...


With TRACK having the string '3/21'... you can do ...

$replace(%TRACK%,'/',' of ')

... which gives the result: '3 of 21'

DD.20111026.1523.CEST, DD.20150723.1433.CEST

Thanks to all for the extensive help, it is very much appreciated!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.