martin
17-08-2009, 15:57
Ciao everybody,
I just made a script that can read the ID3v1 tags from a MP3 file. Please grab it if you can use it :-)
The only problem I have is reading the genre. It's a BYTE but I don't know how I can convert a byte to a number :oops: It would be great if somebody can solve this
uses "file"
uses "console"
dim g as string = "Blues,Classic Rock,Country,Dance,Disco,Funk,Grunge,Hip-Hop,Jazz,Metal,New Age,Oldies,Other,Pop,R&B,Rap,Reggae,Rock,Techno,Industrial,Alternative,Ska,Death Metal,Pranks,Soundtrack,Euro-Techno,Ambient,Trip-Hop,Vocal,Jazz+Funk,Fusion,Trance,Classical,Instrumental,Acid,House,Game,Sound Clip,Gospel,Noise,AlternRock,Bass,Soul,Punk,Space,Meditative,Instrumental Pop,Instrumental Rock,Ethnic,Gothic,Darkwave,Techno-Industrial,Electronic,Pop-Folk,Eurodance,Dream,Southern Rock,Comedy,Cult,Gangsta,Top 40,Christian Rap,Pop/Funk,Jungle,Native American,Cabaret,New Wave,Psychadelic,Rave,Showtunes,Trailer,Lo-Fi,Tribal,Acid Punk,Acid Jazz,Polka,Retro,Musical,Rock & Roll,Hard Rock,Folk,Folk-Rock,National Folk,Swing,Fast Fusion,Bebob,Latin,Revival,Celtic,Bluegrass,Avantgarde,Gothic Rock,Progressive Rock,Psychedelic Rock,Symphonic Rock,Slow Rock,Big Band,Chorus,Easy Listening,Acoustic,Humour,Speech,Chanson,Opera,Chamber Music,Sonata,Symphony,Booty Bass,Primus,Porn Groove,Satire,Slow Jam,Club,Tango,Samba,Folklore,Ballad,Power Ballad,Rhythmic Soul,Freestyle,Duet,Punk Rock,Drum Solo,A capella,Euro-House,Dance Hall"
dim style(126) as string
split(g,",",style)
Type Tag
Header As String * 3
SongTitle As String * 30
Artist As String * 30
Album As String * 30
Year As String * 4
Comment As String * 30
Genre As Byte
End Type
Dim ID3Tag as Tag
dim filename as string = "YourMp3File.mp3"
Dim FileNum As Long = FILE_OPEN(FileName,"Binary")
file_seek(filenum,file_lof(filenum)-127)
ID3Tag.header=file_Get(FileNum, 3)
id3tag.songtitle=file_Get(filenum,30)
id3tag.artist=file_Get(filenum,30)
id3tag.album=file_Get(filenum,30)
id3tag.year=file_Get(filenum,4)
id3tag.comment=file_Get(filenum,30)
id3tag.genre=file_Get(filenum,1)
file_Close(FileNum)
if ID3Tag.header="TAG" then
printl "HEADER " & ID3Tag.header
printl "Title " & trim$(ID3tag.songtitle)
printl "Artist " & trim$(ID3tag.artist)
printl "Album " & trim$(ID3tag.album)
printl "Year " & trim$(ID3tag.year)
'printl "Genre " & style(cvbyt(id3tag.genre)+1)
end if
printl "press key to stop"
waitkey
I just made a script that can read the ID3v1 tags from a MP3 file. Please grab it if you can use it :-)
The only problem I have is reading the genre. It's a BYTE but I don't know how I can convert a byte to a number :oops: It would be great if somebody can solve this
uses "file"
uses "console"
dim g as string = "Blues,Classic Rock,Country,Dance,Disco,Funk,Grunge,Hip-Hop,Jazz,Metal,New Age,Oldies,Other,Pop,R&B,Rap,Reggae,Rock,Techno,Industrial,Alternative,Ska,Death Metal,Pranks,Soundtrack,Euro-Techno,Ambient,Trip-Hop,Vocal,Jazz+Funk,Fusion,Trance,Classical,Instrumental,Acid,House,Game,Sound Clip,Gospel,Noise,AlternRock,Bass,Soul,Punk,Space,Meditative,Instrumental Pop,Instrumental Rock,Ethnic,Gothic,Darkwave,Techno-Industrial,Electronic,Pop-Folk,Eurodance,Dream,Southern Rock,Comedy,Cult,Gangsta,Top 40,Christian Rap,Pop/Funk,Jungle,Native American,Cabaret,New Wave,Psychadelic,Rave,Showtunes,Trailer,Lo-Fi,Tribal,Acid Punk,Acid Jazz,Polka,Retro,Musical,Rock & Roll,Hard Rock,Folk,Folk-Rock,National Folk,Swing,Fast Fusion,Bebob,Latin,Revival,Celtic,Bluegrass,Avantgarde,Gothic Rock,Progressive Rock,Psychedelic Rock,Symphonic Rock,Slow Rock,Big Band,Chorus,Easy Listening,Acoustic,Humour,Speech,Chanson,Opera,Chamber Music,Sonata,Symphony,Booty Bass,Primus,Porn Groove,Satire,Slow Jam,Club,Tango,Samba,Folklore,Ballad,Power Ballad,Rhythmic Soul,Freestyle,Duet,Punk Rock,Drum Solo,A capella,Euro-House,Dance Hall"
dim style(126) as string
split(g,",",style)
Type Tag
Header As String * 3
SongTitle As String * 30
Artist As String * 30
Album As String * 30
Year As String * 4
Comment As String * 30
Genre As Byte
End Type
Dim ID3Tag as Tag
dim filename as string = "YourMp3File.mp3"
Dim FileNum As Long = FILE_OPEN(FileName,"Binary")
file_seek(filenum,file_lof(filenum)-127)
ID3Tag.header=file_Get(FileNum, 3)
id3tag.songtitle=file_Get(filenum,30)
id3tag.artist=file_Get(filenum,30)
id3tag.album=file_Get(filenum,30)
id3tag.year=file_Get(filenum,4)
id3tag.comment=file_Get(filenum,30)
id3tag.genre=file_Get(filenum,1)
file_Close(FileNum)
if ID3Tag.header="TAG" then
printl "HEADER " & ID3Tag.header
printl "Title " & trim$(ID3tag.songtitle)
printl "Artist " & trim$(ID3tag.artist)
printl "Album " & trim$(ID3tag.album)
printl "Year " & trim$(ID3tag.year)
'printl "Genre " & style(cvbyt(id3tag.genre)+1)
end if
printl "press key to stop"
waitkey