Track Number Issue

[ http://forums.mp3tag.de/index.php?showtopic=16733 ]


TheWarrior97 ( Dec 23 2012, 21:56)

Post #1

itunes will number tracks, "1 out of 13" Can you all your program to not just assign the track number but also how many tracks are on the cd. One way to do this might be "<keep> / 13"

Unless it can already do this and i haven't found it.

I love your program by the way. For years I have been manually renaming...that could have been cut down to days if I knew of your program.


ohrenkino (Dec 24 2012, 04:26)

Post #2

Have a closer look at the numbering assistant that you find in the menu Tools.


stevehero (Dec 24 2012, 13:58)

Post #3

QUOTE (TheWarrior97 @ Dec 24 2012, 03:56)

>> itunes will number tracks, "1 out of 13" Can you all your program to not just assign the track number but also how many tracks are on the cd. One way to do this might be "<keep> / 13" <<

>> If you already have that info in the TRACK field then you might want to backup the totaltracks into the TOTALTRACKS field. If you don't then just use action #2. <<

Try this group action. Attached File _Script_Test_TEST.mta ( 215bytes )

Begin Action Group _Script Test#TEST

Action #1
Actiontype 5: Format value
Field ______: TOTALTRACKS
Formatstring: $replace($num($if($eql($regexp(%track%,'^\d+\/\d+$','yes'),'yes'),$regexp(%track%,'^\d+\/(\d+)$','$1'),%totaltracks%),1),0,)

Action #2
Actiontype 5: Format value
Field ______: TRACK
Formatstring: $num($fmtNum(%track%),1)

End Action Group _Script Test#TEST (2 Actions)

This post has been edited by stevehero: Dec 24 2012, 13:59


donstrack (Dec 24 2012, 15:22)

Post #4

QUOTE (stevehero @ Dec 24 2012, 12:58)

>> If you already have that info in the TRACK field then you might want to backup the totaltracks into the TOTALTRACKS field. If you don't then just use action #2. <<

>> Try this group action. Attached File _Script_Test_TEST.mta ( 215bytes ) <<

I'm new to the forum, and was just searching for the tag for Total Tracks.

I have quite a few Track tags formatted as #/#, and your script worked.

I see that TOTALTRACKS is stored as a user-defined TXXX field, as shown in this capture from MP3Diags.

I created a custom column for the %TOTALTRACKS% tag, and it displays just fine.

Thank you.

Edit: I should add that I renamed your script as "Add-Edit_Total-Tracks".

Edit: I use foobar2000 as my player, with Columns UI and NGPlaylist. I hadn't noticed previously, but if I add a Total Tracks column, formatted as [%TOTALTRACK%], then foobar reads the #/# in the %track% field and displays the total # in the new Total Tracks column. I used your script on only one album, but after adding the new column, all albums with #/# display properly.

--DS

This post has been edited by donstrack: Dec 24 2012, 15:43


donstrack (Dec 25 2012, 08:27)

Post #5

After discovering that foorbar2000 properly handles #/# in the %TRACK% tag without using the script that "stevehero" shared with us, I noticed that too many of my %TRACK% tags are missing the #/# formatting, but at least have the track number. Out of 11,000+ songs, in 1,000+ folders, most also have numbers 1-9 with leading zeros.

I took the advice of "ohrenkino" and looked at the Autonumbering Wizard in the Tools menu (Ctrl-K). Using the settings shown below, it fixed the missing #/# very nicely. The folder that I tried it on had some numbers with leading zeros, and some without.

Are leading zeros a personal preference thing, or is there a recommended best practice that says either use them, or don't use them.

--DS


garym (Dec 25 2012, 09:41)

Post #6

QUOTE (donstrack @ Dec 25 2012, 10:27)

>> Are leading zeros a personal preference thing, or is there a recommended best practice that says either use them, or don't use them. <<

I like leading zeros in track file name. Looking at file listings in non audio programs show files in track order instead of tracks like 10 coming before 2.

This post has been edited by garym: Dec 25 2012, 09:41


DetlevD (Dec 25 2012, 09:59)

Post #7

QUOTE (TheWarrior97 @ Dec 24 2012, 04:56)

>> ... For years I have been manually renaming...that could have been cut down to days ... <<

Try the following action group with TRACK content like ...

123
Track 123 out of 333 tracks.
1/14
01/09
001/333
Unknown

Begin Action Group Format TRACK#Set TRACK and TOTALTRACKS

Action #1
Actiontype 5: Format value
Field ______: TEMP
Formatstring: $if($eql($regexp(%TRACK%,'^0*(\d+)$','match'),'match'),$regexp(%TRACK%,'^0*(\d+)$','$1==='),$if($eql($regexp(%TRACK%,'^\D*0*(\d+)\D*0*(\d+)\D*$','match'),'match'),$regexp(%TRACK%,'^\D*0*(\d+)\D*0*(\d+)\D*$','$1===$2'),%TRACK%'==='))'==='

Action #2
Actiontype 7: Import tag fields (guess values)
Source format __: %TEMP%
Guessing pattern: %TRACK%===%TOTALTRACKS%===%TEMP%

End Action Group Format TRACK#Set TRACK and TOTALTRACKS (2 Actions)


donstrack (Dec 25 2012, 11:11)

Post #8

QUOTE (garym @ Dec 25 2012, 08:41)

>> I like leading zeros in track file name. Looking at file listings in non audio programs show files in track order instead of tracks like 10 coming before 2. <<

I agree for file names. But for MP3 tags, I was thinking that no leading zeros might be best. But foobar2000 uses leading zeros regardless of what the tag shows, so I'll be using leading zeros in the MP3Tag Autonumbering Wizard.

DetlevD: I was trying to figure out regular expressions for this purpose, but your action beat me to it.

Thanks for your help.

--DS

This post has been edited by donstrack: Dec 25 2012, 11:13


garym (Dec 25 2012, 11:33)

Post #9

QUOTE (donstrack @ Dec 25 2012, 12:11)

>> I agree for file names. But for MP3 tags, I was thinking that no leading zeros might be best. But foobar2000 uses leading zeros regardless of what the tag shows, so I'll be using leading zeros in the MP3Tag Autonumbering Wizard. <<

I use leading zeros in my tags too for both flac and mp3. Works with everything I use.


donstrack (Dec 25 2012, 11:51)

Post #10

QUOTE (DetlevD @ Dec 25 2012, 08:59)

>> Try the following action group with TRACK content like ...

123
Track 123 out of 333 tracks.
1/14
01/09
001/333
Unknown

Begin Action Group Format TRACK#Set TRACK and TOTALTRACKS

Action #1
Actiontype 5: Format value
Field ______: TEMP
Formatstring: $if($eql($regexp(%TRACK%,'^0*(\d+)$','match'),'match'),$regexp(%TRACK%,'^0*(\d+)$','$1==='),$if($eql($regexp(%TRACK%,'^\D*0*(\d+)\D*0*(\d+)\D*$','match'),'match'),$regexp(%TRACK%,'^\D*0*(\d+)\D*0*(\d+)\D*$','$1===$2'),%TRACK%'==='))'==='

Action #2
Actiontype 7: Import tag fields (guess values)
Source format __: %TEMP%
Guessing pattern: %TRACK%===%TOTALTRACKS%===%TEMP%

>> End Action Group Format TRACK#Set TRACK and TOTALTRACKS (2 Actions)

Is there a way to only change single digit tracks to leading zeros (#/## to ##/##) to what is already in the track number. Some of my folders have only one or two songs from an album that originally had 15 songs, but I want to preserve the original track number.

I've tried the different settings in Autonumbering wizard, but it only counts the total count.

--DS

This post has been edited by donstrack: Dec 25 2012, 11:56


DetlevD (Dec 25 2012, 12:08)

Post #11

QUOTE (donstrack @ Dec 25 2012, 18:51)

>> Is there a way to only change single digit tracks to leading zeros (#/## to ##/##) to what is already in the track number. ... <<

See scripting function $num, e. g. $num(%TRACK%,2).

DD.20121225.1904.CET

You may apply the following action group to adjust the format of a tag-field TRACK with a given format from ...
"#/##" to "##/##"
"#/###" to "###/###"
"#/####" to "####/####"
... and so forth.

It helps to understand the string "#/##" as a list of numbers separated by the slash character.
The first number of the given number list will be prepended with zero digits to reach the width of the second number.

Begin Action Group Format TRACK#Format TRACK #.## to ##.##

Action #1
Actiontype 5: Format value
Field ______: TEMP
Formatstring: $replace(%TRACK%,'/','\\')

Action #2
Actiontype 5: Format value
Field ______: TRACK
Formatstring: $num($meta(TEMP,0),$len($meta(TEMP,1)))'/'$meta(TEMP,1)

Action #3
Actiontype 9: Remove fields
Fields to remove (semicolon separated): TEMP

End Action Group Format TRACK#Format TRACK #.## to ##.## (3 Actions)

###