I made a script that guesses the tracknumber from the filename of the track, if theres no tracknumber info in the meta tag. I don't believe its that effecient, but it works.
I use foobar 0.9.5.3 with columnsui
All my albums are tagged 01-artist-song for single albums and 101-artist-song, 102, 103 etc for multidisc albums. Now what my code does: it gets the first 3 characters from the filename. If its 01- it will delete the -
Thats easy.
For multicd it echos 101 ; 102 ; etc. Then i let it subtrack 100, so 104 will become 4 (to which an 0 will be added in the end). When it has stripped it, it checks again if its still > 100 ... so 204 will become 104, will become 4. I worked it out so that it works up to a 6CD album.
Now every multicd is labeled like this:
CD1:
01
02
03
04
etc.
CD2:
01
02
03
etc.
but what i would like it to do, is to keep counting from where it stopped in the previous cd. So:
CD1:
01
02
03
CD2
04
05
06
CD3
07
08
So really i need a way for my code to know how much tracks are present on the previous cd...
i cant figure it out, who of you more experienced guys can help me out?
Tnx in advance
[hope this is in the right thread]
Here's the code:
// START TRACKNR-GUESS
// get first 3 characters of the filename
$puts(raw_track,$padcut(%filename%,3))
// delete the - or _ sign if its there
$puts(raw_track,$replace($get(raw_track),-,))
$puts(raw_track,$replace($get(raw_track),_,))
// store the tracknumber minus x
$puts(raw_min_100,$sub($get(raw_track),100))
$puts(raw_min_200,$sub($get(raw_min_100),100))
$puts(raw_min_300,$sub($get(raw_min_200),100))
$puts(raw_min_400,$sub($get(raw_min_300),100))
$puts(raw_min_500,$sub($get(raw_min_400),100))
$puts(raw_min_600,$sub($get(raw_min_500),100))
// if track_raw is greater than 100 go on, else keep it
$puts(check_1,$ifgreater($get(raw_track),100,
$get(raw_min_100),$get(raw_track)))
$puts(check_2,$ifgreater($get(check_1),100,$get(raw_min_200),$get(raw_min_100)))
$puts(check_3,$ifgreater($get(check_2),100,$get(raw_min_300),$get(raw_min_200)))
$puts(check_4,$ifgreater($get(check_3),100,$get(raw_min_400),$get(raw_min_300)))
$puts(check_5,$ifgreater($get(check_4),100,$get(raw_min_500),$get(raw_min_400)))
$puts(check_6,$ifgreater($get(check_5),100,$get(raw_min_600),$get(raw_min_500)))
// check at each check if the number is greater than 100
$puts(tracknr_raw,
$ifgreater($get(check_1),100,
$ifgreater($get(check_2),100,
$ifgreater($get(check_3),100,
$ifgreater($get(check_4),100,
$ifgreater($get(check_5),100,
$get(check_6),
$get(check_5)),
$get(check_4)),
$get(check_3)),
$get(check_2)),
$get(check_1)))
// get the guessed tracknumber if there isnt one in the meta tag
// also, add a 0 to it, and if its then like 001, remove the 0 again
$set_global(tracknr,$if(%tracknumber%,%tracknumber%,
$ifgreater($get(tracknr_raw),9,$get(tracknr_raw),
$replace(0$get(tracknr_raw),00,0)
)
)
)
$puts(tracknr,$get_global(tracknr))
// END TRACKNR-GUESS