Posted By: txesmi
[SUB] some tags from mp3 files - 12/20/15 17:45
Hi!
Here goes a little code snippet that takes title, artist, album and year tags from ID3 tagged mp3 files.
Enjoy!
Here goes a little code snippet that takes title, artist, album and year tags from ID3 tagged mp3 files.
Code:
#include <acknex.h> #define PRAGMA_POINTER typedef struct TAGDATA { char title[31]; char artist[31]; char album[31]; char year[5]; } TAGDATA; TAGDATA tagData; void tagData_startup () { tagData.title[30] = NULL; tagData.artist[30] = NULL; tagData.album[30] = NULL; tagData.year[4] = NULL; } BOOL getTagData ( char *filename ) { char text[31]; text[30] = NULL; long size; char *data = file_load ( filename, NULL, &size ); if ( !data ) return FALSE; data += size - 125; memcpy ( tagData.title, data, 30 ); memcpy ( tagData.artist, data+30, 30 ); memcpy ( tagData.album, data+60, 30 ); memcpy ( tagData.year, data+90, 4 ); file_load ( NULL, data, &size ); return TRUE; } void main () { getTagData ( "playlist\\SoA - Vete a Cuba.mp3" ); printf ( tagData.title ); printf ( tagData.artist ); printf ( tagData.album ); printf ( tagData.year ); sys_exit ( NULL ); }
Enjoy!