Add zero in front of track number

I tried using replace with regular expressions '.' to '0.' and '%track%' to '0%track%'but neither worked. Can anyone else figure this out?

Thanks a lot!

~Owen

Try $num(%track%,2) in a format value.

Have a nice day :slight_smile:

1 Like

Wow! That was amazingly helpful! And ridiculously fast, too! You, my friend, ROCK. =D

Hey, do you know where I could look to learn the structure behind that? I mean, WHY it works, so I could recreate it myself from my own understanding, you know?

Again, thanks a lot! =]

~Owen

No problemo

I found it a few days ago in a very helpful page : Scripting functions
(Help/contents/More features -> Scripting functions)

You will find the description of this function in "Pad decimal number with leading zeros" section.

As you see, I am a newbee in this forum and use Mp3tag since a week only.
But since I found this page, everything is simplier !

Hope that you'll found it useful too.

1 Like

I'm looking to add Leading 0's to my tracks as well, but the help guide doesn't explain where and I how I enter this function, and neither did 5 mins of googling. Can anyone give me a quick scripting 101 so I can do this? Thanks.

Ooh, I can answer this one!

ctrl-a in the list of files in the main window, right click, convert, actions, standard (double click on it), new (top right hand side button with the icon of a yellow star on a white page), "Format value" from the drop down (OK), single click on that entry (now in the list) to highlight it, press OK in the bottom of the actions window, press OK again in the actions groups window, aaaannd you're done.

Wow, I hadn't realized how ridiculously complicated that was before describing it. How the hell did I figure that out the first time?

Anyway yeah, this will only add a leading zero to single digit track numbers, so you don't have to worry about making '9' into '09' but also making '10' into '010', for instance. You can just ctrl-a the whole list of files. Not sure about triple digit track numbers, but I wouldn't think you'd have to deal with those, amiright?

Yay, I'm helpful! =]

~Owen

That's done it. Many thanks!

OK, if you are done.
Just a note: if you want to keep the numbering in your collection unified then you should set the numbering to 3 digits. There are some audiobooks or podcast-collections that have more than 100 tracks for one album. So by setting it to 3 digits always you do not have to worry about 09s and 010s.
You can easily modify the existing numbering with an action that reformats the tag field:

Action of the type "Format tag field"
Format tag Track
Format string: $num(%track%,3)

Hmmm...any idea why both the Track number wizard AND scripting with $num(%track%,3) fails to put leading zeros in front of my tracks?

Everything else works OK, I can add and delete track numbers so it isn't a permissions or read-only issue. No error messages, executes fine but just doesn't add the zeros. Strange AND frustrating!

Mark.

What audio format are you using? m4a/mp4 don't support leading zeroes.

Badda-bing! I did not know that and yes, that is exactly what I am using. Every day is a school day.

In that case, if I create a text file to import, exactly what is the format to put in it to rename the title field. I've read the help files on it but it still isn't clear; I'm much better learning from an example. If I was to guess, I would choose "text file - tag", choose %title% in the Format string: box and point it to a file that had one line entry per file in the format of "filename - 001".

Does that look right?

It will put "filename - 001" in the title. I don't know what exactly you want.

Hi guys,

What if you have a 2 DISC album with the total of 20 tracks. Track 1 - 10 set to DISC 1 and 11 - 20 on DISC 2. I get this wrong since the DISC numbering is from 1 - 20

[size="2"]%discnumber%$num(%track%,2)-%artist%-%title%[/size]

Result:
101-artist-title.mp3
102-artist-title.mp3
103-artist-title.mp3
104-artist-title.mp3
105-artist-title.mp3
106-artist-title.mp3
107-artist-title.mp3
108-artist-title.mp3
109-artist-title.mp3
110-artist-title.mp3
211-artist-title.mp3
212-artist-title.mp3
213-artist-title.mp3
214-artist-title.mp3
215-artist-title.mp3
216-artist-title.mp3
217-artist-title.mp3
218-artist-title.mp3
219-artist-title.mp3
220-artist-title.mp3

Is there any way to accoplish the result below without doing this a manual procedure ? Instead of DISC 2 starts with 211 is starts with 201

Result:
101-artist-title.mp3
102-artist-title.mp3
103-artist-title.mp3
104-artist-title.mp3
105-artist-title.mp3
106-artist-title.mp3
107-artist-title.mp3
108-artist-title.mp3
109-artist-title.mp3
110-artist-title.mp3
201-artist-title.mp3
202-artist-title.mp3
203-artist-title.mp3
204-artist-title.mp3
205-artist-title.mp3
206-artist-title.mp3
207-artist-title.mp3
208-artist-title.mp3
209-artist-title.mp3
210-artist-title.mp3

// Regards