Help - Search - Members - Calendar
Full Version: Insert Track Number Into Title
Mp3tag Forums > Mp3tag - International > General Discussion
Alexi
This should be simple but does not work. I would like to insert into the TITLE tag the track number. Currently there is a dummy string "#" in the title tag and I wish to replace it with the actual track number. I'm using the Replace with Regular Expression, where "Field" = "TITLE", "Regular expression" = "#", and "Replace matches with" = "$num(%track%,3)". This returns a value of '000'. I'm expecting the actual value of the track number padded with two zeros. How can I get this to work?

Thanks. dry.gif
Sebastian Mares
QUOTE (Alexi @ Mar 15 2005, 09:56 AM)
This should be simple but does not work. I would like to insert into the TITLE tag the track number. Currently there is a dummy string "#" in the title tag and I wish to replace it with the actual track number. I'm using the Replace with Regular Expression, where "Field" = "TITLE", "Regular expression" = "#", and "Replace matches with" = "$num(%track%,3)". This returns a value of '000'. I'm expecting the actual value of the track number padded with two zeros. How can I get this to work?

Thanks. dry.gif
*


Well, it doesn't work the way you want, AFAIK. If you want to add a track number at the beginning of the title field, simply replace "#" by nothing and add another action which formats values. Use TITLE as field and "$num(%track%,3) %title%" as format string.
Alexi
QUOTE (Sebastian Mares @ Mar 15 2005, 05:39 AM)
Well, it doesn't work the way you want, AFAIK. If you want to add a track number at the beginning of the title field, simply replace "#" by nothing and add another action which formats values. Use TITLE as field and "$num(%track%,3) %title%" as format string.
*


Are you saying I cannot *insert* the track number in the middle of the TITLE string using Mp3tag? Does Mp3tag have an enumerate function which would apply to a selection of files/tags? Something like $enum(x,y), where x=starting value, and y=increment. Also, the ability to create variables which are based on information in tags would be nice.

Thanks!
dano
I don't know if I understand this right, but you can try FORMAT VALUE on TITLE with:
$left(%title%,$sub($strchr(%title%,#),1))$num(%track%,3)$right(%title%,$sub($strchr(%title%,#),1))
Alexi
QUOTE (dano @ Mar 15 2005, 11:12 AM)
I don't know if I understand this right, but you can try FORMAT VALUE on TITLE with:
$left(%title%,$sub($strchr(%title%,#),1))$num(%track%,3)$right(%title%,$sub($strchr(%title%,#),1))
*


Thanks dano!

This is very close. If I start with this title: "Sonata in D Major, K. # -- Allegro" and apply your expression, I get "Sonata in D Major, K. 161Major, K. # -- Allegro". The result should be "Sonata in D Major, K. 161 -- Allegro".
dano
Ok, I didn't look what $right really does wink.gif
Sp replace
$right(%title%,$sub($strchr(%title%,#),1))
with
$right(%title%,$sub($len(%title%),$strchr(%title%,#)))
Alexi
QUOTE (dano @ Mar 15 2005, 11:46 AM)
Ok, I didn't look what $right really does wink.gif
Sp replace
$right(%title%,$sub($strchr(%title%,#),1))
with
$right(%title%,$sub($len(%title%),$strchr(%title%,#)))
*


dano,

This worked beautifully. Brilliant, you saved me much work. Where can I learn more about scripting for Mp3tag?

Thanks!
dano
In Mp3tag, press F1 and you see the Help.
There's a link to the scripting reference.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.