Added Disc # metadata item based on bug 571 (added id3v2 support)
git-svn-id: https://svn.musicpd.org/mpd/trunk@4131 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
8aca530b86
commit
4324150b42
@ -106,14 +106,19 @@ static void flacParseReplayGain(const FLAC__StreamMetadata *block,
|
|||||||
/* tracknumber is used in VCs, MPD uses "track" ..., all the other
|
/* tracknumber is used in VCs, MPD uses "track" ..., all the other
|
||||||
* tag names match */
|
* tag names match */
|
||||||
static const char * VORBIS_COMMENT_TRACK_KEY = "tracknumber";
|
static const char * VORBIS_COMMENT_TRACK_KEY = "tracknumber";
|
||||||
|
static const char * VORBIS_COMMENT_DISC_KEY = "discnumber";
|
||||||
|
|
||||||
static unsigned int commentMatchesAddToTag(
|
static unsigned int commentMatchesAddToTag(
|
||||||
const FLAC__StreamMetadata_VorbisComment_Entry * entry,
|
const FLAC__StreamMetadata_VorbisComment_Entry * entry,
|
||||||
unsigned int itemType,
|
unsigned int itemType,
|
||||||
MpdTag ** tag)
|
MpdTag ** tag)
|
||||||
{
|
{
|
||||||
const char * str = (itemType == TAG_ITEM_TRACK) ?
|
const char * str;
|
||||||
VORBIS_COMMENT_TRACK_KEY : mpdTagItemKeys[itemType];
|
switch (itemType) {
|
||||||
|
case TAG_ITEM_TRACK: str = VORBIS_COMMENT_TRACK_KEY; break;
|
||||||
|
case TAG_ITEM_DISC: str = VORBIS_COMMENT_DISC_KEY; break;
|
||||||
|
default: str = mpdTagItemKeys[itemType];
|
||||||
|
}
|
||||||
size_t slen = strlen(str);
|
size_t slen = strlen(str);
|
||||||
int vlen = entry->length - slen - 1;
|
int vlen = entry->length - slen - 1;
|
||||||
|
|
||||||
|
@ -385,6 +385,10 @@ MpdTag * mp4DataDup(char * file, int * mp4MetadataFound) {
|
|||||||
addItemToMpdTag(ret, TAG_ITEM_TRACK, value);
|
addItemToMpdTag(ret, TAG_ITEM_TRACK, value);
|
||||||
*mp4MetadataFound = 1;
|
*mp4MetadataFound = 1;
|
||||||
}
|
}
|
||||||
|
else if(0 == strcasecmp("disc", item)) { /* Is that the correct id? */
|
||||||
|
addItemToMpdTag(ret, TAG_ITEM_DISC, value);
|
||||||
|
*mp4MetadataFound = 1;
|
||||||
|
}
|
||||||
else if(0 == strcasecmp("genre", item)) {
|
else if(0 == strcasecmp("genre", item)) {
|
||||||
addItemToMpdTag(ret, TAG_ITEM_GENRE, value);
|
addItemToMpdTag(ret, TAG_ITEM_GENRE, value);
|
||||||
*mp4MetadataFound = 1;
|
*mp4MetadataFound = 1;
|
||||||
|
@ -155,12 +155,17 @@ void ogg_getReplayGainInfo(char ** comments, ReplayGainInfo ** infoPtr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char * VORBIS_COMMENT_TRACK_KEY = "tracknumber";
|
static const char * VORBIS_COMMENT_TRACK_KEY = "tracknumber";
|
||||||
|
static const char * VORBIS_COMMENT_DISC_KEY = "discnumber";
|
||||||
|
|
||||||
static inline unsigned int ogg_parseCommentAddToTag(char * comment,
|
static inline unsigned int ogg_parseCommentAddToTag(char * comment,
|
||||||
unsigned int itemType, MpdTag ** tag)
|
unsigned int itemType, MpdTag ** tag)
|
||||||
{
|
{
|
||||||
const char * needle = (itemType == TAG_ITEM_TRACK) ?
|
const char * needle;
|
||||||
VORBIS_COMMENT_TRACK_KEY : mpdTagItemKeys[itemType];
|
switch (itemType) {
|
||||||
|
case TAG_ITEM_TRACK: needle = VORBIS_COMMENT_TRACK_KEY; break;
|
||||||
|
case TAG_ITEM_DISC: needle = VORBIS_COMMENT_DISC_KEY; break;
|
||||||
|
default: needle = mpdTagItemKeys[itemType];
|
||||||
|
}
|
||||||
unsigned int len = strlen(needle);
|
unsigned int len = strlen(needle);
|
||||||
|
|
||||||
if(strncasecmp(comment, needle, len) == 0 && *(comment+len) == '=') {
|
if(strncasecmp(comment, needle, len) == 0 && *(comment+len) == '=') {
|
||||||
|
@ -46,6 +46,9 @@
|
|||||||
#ifndef ID3_FRAME_COMPOSER
|
#ifndef ID3_FRAME_COMPOSER
|
||||||
#define ID3_FRAME_COMPOSER "TCOM"
|
#define ID3_FRAME_COMPOSER "TCOM"
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef ID3_FRAME_DISC
|
||||||
|
#define ID3_FRAME_DISC "TPOS"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char * mpdTagItemKeys[TAG_NUM_OF_ITEM_TYPES] =
|
char * mpdTagItemKeys[TAG_NUM_OF_ITEM_TYPES] =
|
||||||
@ -59,7 +62,8 @@ char * mpdTagItemKeys[TAG_NUM_OF_ITEM_TYPES] =
|
|||||||
"Date",
|
"Date",
|
||||||
"Composer",
|
"Composer",
|
||||||
"Performer",
|
"Performer",
|
||||||
"Comment"
|
"Comment",
|
||||||
|
"Disc"
|
||||||
};
|
};
|
||||||
|
|
||||||
static mpd_sint8 ignoreTagItems[TAG_NUM_OF_ITEM_TYPES];
|
static mpd_sint8 ignoreTagItems[TAG_NUM_OF_ITEM_TYPES];
|
||||||
@ -171,6 +175,7 @@ MpdTag * parseId3Tag(struct id3_tag * tag) {
|
|||||||
ret = getID3Info(tag, ID3_FRAME_GENRE, TAG_ITEM_GENRE, ret);
|
ret = getID3Info(tag, ID3_FRAME_GENRE, TAG_ITEM_GENRE, ret);
|
||||||
ret = getID3Info(tag, ID3_FRAME_COMPOSER, TAG_ITEM_COMPOSER, ret);
|
ret = getID3Info(tag, ID3_FRAME_COMPOSER, TAG_ITEM_COMPOSER, ret);
|
||||||
ret = getID3Info(tag, ID3_FRAME_COMMENT, TAG_ITEM_COMMENT, ret);
|
ret = getID3Info(tag, ID3_FRAME_COMMENT, TAG_ITEM_COMMENT, ret);
|
||||||
|
ret = getID3Info(tag, ID3_FRAME_DISC, TAG_ITEM_DISC, ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,9 @@
|
|||||||
#define TAG_ITEM_COMPOSER 7
|
#define TAG_ITEM_COMPOSER 7
|
||||||
#define TAG_ITEM_PERFORMER 8
|
#define TAG_ITEM_PERFORMER 8
|
||||||
#define TAG_ITEM_COMMENT 9
|
#define TAG_ITEM_COMMENT 9
|
||||||
|
#define TAG_ITEM_DISC 10
|
||||||
|
|
||||||
#define TAG_NUM_OF_ITEM_TYPES 10
|
#define TAG_NUM_OF_ITEM_TYPES 11
|
||||||
|
|
||||||
extern char * mpdTagItemKeys[];
|
extern char * mpdTagItemKeys[];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user