2004-02-24 00:41:20 +01:00
|
|
|
/* the Music Player Daemon (MPD)
|
|
|
|
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu
|
|
|
|
* This project's homepage is: http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TAG_H
|
|
|
|
#define TAG_H
|
|
|
|
|
2004-03-18 04:29:25 +01:00
|
|
|
#include "../config.h"
|
|
|
|
|
2004-11-10 22:58:27 +01:00
|
|
|
#include "mpd_types.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2004-02-24 00:41:20 +01:00
|
|
|
#include <stdio.h>
|
2004-06-01 14:50:15 +02:00
|
|
|
#ifdef HAVE_ID3TAG
|
|
|
|
#ifdef USE_MPD_ID3TAG
|
|
|
|
#include "libid3tag/id3tag.h"
|
|
|
|
#else
|
|
|
|
#include <id3tag.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2004-11-10 22:58:27 +01:00
|
|
|
#define TAG_ITEM_ARTIST 0
|
|
|
|
#define TAG_ITEM_ALBUM 1
|
|
|
|
#define TAG_ITEM_TITLE 2
|
|
|
|
#define TAG_ITEM_TRACK 3
|
|
|
|
#define TAG_ITEM_NAME 4
|
|
|
|
#define TAG_ITEM_GENRE 5
|
|
|
|
#define TAG_ITEM_DATE 6
|
2005-03-05 23:24:10 +01:00
|
|
|
#define TAG_ITEM_COMPOSER 7
|
|
|
|
#define TAG_ITEM_PERFORMER 8
|
|
|
|
#define TAG_ITEM_COMMENT 9
|
2004-11-10 22:58:27 +01:00
|
|
|
|
2005-03-05 23:24:10 +01:00
|
|
|
#define TAG_NUM_OF_ITEM_TYPES 10
|
2004-11-10 22:58:27 +01:00
|
|
|
|
|
|
|
extern char * mpdTagItemKeys[];
|
|
|
|
|
|
|
|
typedef struct _MpdTagItem {
|
|
|
|
mpd_sint8 type;
|
|
|
|
char * value;
|
|
|
|
} MpdTagItem;
|
|
|
|
|
2004-02-24 00:41:20 +01:00
|
|
|
typedef struct _MpdTag {
|
2004-03-11 01:16:49 +01:00
|
|
|
int time;
|
2004-11-10 22:58:27 +01:00
|
|
|
MpdTagItem * items;
|
|
|
|
mpd_uint8 numOfItems;
|
2004-02-24 00:41:20 +01:00
|
|
|
} MpdTag;
|
|
|
|
|
2004-06-01 14:50:15 +02:00
|
|
|
#ifdef HAVE_ID3TAG
|
|
|
|
MpdTag * parseId3Tag(struct id3_tag *);
|
|
|
|
#endif
|
|
|
|
|
2005-03-07 01:51:21 +01:00
|
|
|
MpdTag * apeDup(char * file);
|
|
|
|
|
2004-05-31 04:21:06 +02:00
|
|
|
MpdTag * id3Dup(char * file);
|
2004-05-31 03:21:17 +02:00
|
|
|
|
2004-02-24 00:41:20 +01:00
|
|
|
MpdTag * newMpdTag();
|
|
|
|
|
2004-11-10 22:58:27 +01:00
|
|
|
void initTagConfig();
|
|
|
|
|
|
|
|
void clearItemsFromMpdTag(MpdTag * tag, int itemType);
|
|
|
|
|
2004-05-31 13:42:46 +02:00
|
|
|
void clearMpdTag(MpdTag * tag);
|
|
|
|
|
2004-02-24 00:41:20 +01:00
|
|
|
void freeMpdTag(MpdTag * tag);
|
|
|
|
|
2004-11-10 22:58:27 +01:00
|
|
|
void addItemToMpdTagWithLen(MpdTag * tag, int itemType, char * value, int len);
|
|
|
|
|
|
|
|
#define addItemToMpdTag(tag, itemType, value) \
|
|
|
|
addItemToMpdTagWithLen(tag, itemType, value, strlen(value))
|
|
|
|
|
2004-02-24 00:41:20 +01:00
|
|
|
void printMpdTag(FILE * fp, MpdTag * tag);
|
|
|
|
|
|
|
|
MpdTag * mpdTagDup(MpdTag * tag);
|
|
|
|
|
2004-06-01 12:28:06 +02:00
|
|
|
int mpdTagsAreEqual(MpdTag * tag1, MpdTag * tag2);
|
|
|
|
|
2004-11-10 22:58:27 +01:00
|
|
|
/* *last shoudl be initialzed to -1 before calling this function */
|
|
|
|
char * getNextItemFromMpdTag(MpdTag * tag, int itemType, int * last);
|
|
|
|
|
2004-02-24 00:41:20 +01:00
|
|
|
#endif
|