diff options
author | Kjetil Ørbekk <orbekk@pvv.ntnu.no> | 2007-11-21 20:09:39 +0100 |
---|---|---|
committer | Kjetil Ørbekk <orbekk@pvv.ntnu.no> | 2007-11-21 20:09:39 +0100 |
commit | e660aacdb3fe0f79d1531d9aa0c8ce2f158b7ae3 (patch) | |
tree | b733c00074911793d6299c03ac897179c43cab8f /id3test.c | |
parent | 7de7ada912e81e4eedab3a1e94992b4ab778a669 (diff) |
- Added Makefile
- Moved `test programs` out of source tree
(So the Makefile actually works)
Diffstat (limited to 'id3test.c')
-rw-r--r-- | id3test.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/id3test.c b/id3test.c new file mode 100644 index 0000000..6136112 --- /dev/null +++ b/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, ID3Field_Size (field)); + + printf("Artist: %s\n", artist); + + return 0; +} |