diff options
author | Kjetil Ørbekk <orbekk@pvv.ntnu.no> | 2007-11-21 11:48:37 +0100 |
---|---|---|
committer | Kjetil Ørbekk <orbekk@pvv.ntnu.no> | 2007-11-21 11:48:37 +0100 |
commit | 233ca76f5355038422b7e6035fbb34bb28aa0d9e (patch) | |
tree | de149f156ad9346310e06f547d2458a5ea5cd3e5 /src | |
parent | 5f6017e6d217b1d13fd7d095ac496d4ef0bdc410 (diff) |
- Added libid3 test
Diffstat (limited to 'src')
-rw-r--r-- | src/id3test.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/id3test.c b/src/id3test.c new file mode 100644 index 0000000..837a0f9 --- /dev/null +++ b/src/id3test.c @@ -0,0 +1,26 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +#include <id3.h> +#include <stdio.h> +#include "mp3node.h" + +/* Compile with gcc -Wall -lid3 -I../include id3test.c */ + +int main (int argc, char **argv) +{ + if (argc != 2) + return -1; + + struct mnode node; + + node.tag = ID3Tag_New (); + ID3Tag_Link (node.tag, argv[1]); + ID3Frame *artist_frame = ID3Tag_FindFrameWithID (node.tag, ID3FID_LEADARTIST); + + ID3Field *field = ID3Frame_GetField (artist_frame, ID3FN_TEXT); + char *artist = malloc (sizeof(char) * (ID3Field_Size (field) + 1)); + ID3Field_GetASCII (field, artist, 254); + + printf("Artist: %s\n", artist); + + return 0; +} |