gopher_yarrowzoo
08-08-2007, 02:14 AM
okay I'm trying to write a parser for mp3 v2 tags but since all the tags have different data formats (okay so some are similar so I could use a switch statement but I don't wanna huge one :P), I was wondering if say I had all the expected tag types in an array in say a specific format
i.e array(X => array('TRK','TRCK','#N'), .... where X is a ' ' enclosed number and the last column is the format using a customised format code as obviously trying to put exactly what's expected would be hard as some start ($01/$02) to define the encoding - normal / unicode, others are variable length numbers, character fields, $00 dividers etc. So I came up with a way of doing that now how do I get this to parse properly..
$ = $01/$02, # = $00 [$00] depending on $ is 01 or 02, ! = $00 always - divider
A = Alphanumerical (NN)(RM)(CR) - special format, B = Binary Data, C = General Text String, D = DDMM,
E = 3 char currency code, F = Float Number, G = 3 char field, K = [ABCDEFGb#o]only., M = MMDD,
N = Int Number, Q = unknown mutli-bit digit, T = HHMM, U = URL String, V = 1-byte digit,
W = 2-byte digit, X = 3-byte digit, Y = YYYY, Z = 4-byte digit / etc - divisor,
[] possibly repeated section.
Example:
'62' => array('','COMR','$EF[/EF]!YMU!VC#C#[C!B]') - Commercial frame
I'd obviously have to define a few arrays at the start to define valid currency Language codes and somethings are "variable" in length depending on previous parts of the string, but they do appear in a same order.
Any ideas would be useful. I mean I did manage to get the thing to read VBR files and get the song time correct :) So this shouldn't be too hard just trying to get my head around it.
Im thinking of seeing if I can't make this once it all works a stand-alone application that can scan your drive and drag all your mp3 info out and store it in a DB with a "click" to play ability ;).
i.e array(X => array('TRK','TRCK','#N'), .... where X is a ' ' enclosed number and the last column is the format using a customised format code as obviously trying to put exactly what's expected would be hard as some start ($01/$02) to define the encoding - normal / unicode, others are variable length numbers, character fields, $00 dividers etc. So I came up with a way of doing that now how do I get this to parse properly..
$ = $01/$02, # = $00 [$00] depending on $ is 01 or 02, ! = $00 always - divider
A = Alphanumerical (NN)(RM)(CR) - special format, B = Binary Data, C = General Text String, D = DDMM,
E = 3 char currency code, F = Float Number, G = 3 char field, K = [ABCDEFGb#o]only., M = MMDD,
N = Int Number, Q = unknown mutli-bit digit, T = HHMM, U = URL String, V = 1-byte digit,
W = 2-byte digit, X = 3-byte digit, Y = YYYY, Z = 4-byte digit / etc - divisor,
[] possibly repeated section.
Example:
'62' => array('','COMR','$EF[/EF]!YMU!VC#C#[C!B]') - Commercial frame
I'd obviously have to define a few arrays at the start to define valid currency Language codes and somethings are "variable" in length depending on previous parts of the string, but they do appear in a same order.
Any ideas would be useful. I mean I did manage to get the thing to read VBR files and get the song time correct :) So this shouldn't be too hard just trying to get my head around it.
Im thinking of seeing if I can't make this once it all works a stand-alone application that can scan your drive and drag all your mp3 info out and store it in a DB with a "click" to play ability ;).