summaryrefslogtreecommitdiff
path: root/src/id3test.c
blob: 61361126beea49279a5f4ba3ed7214496449018c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
}