From 4324150b42ea7720629b74014401119754429b04 Mon Sep 17 00:00:00 2001 From: Qball Cow Date: Sun, 30 Apr 2006 19:55:56 +0000 Subject: 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 --- src/inputPlugins/_flac_common.c | 9 +++++++-- src/inputPlugins/mp4_plugin.c | 4 ++++ src/inputPlugins/oggvorbis_plugin.c | 9 +++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src/inputPlugins') diff --git a/src/inputPlugins/_flac_common.c b/src/inputPlugins/_flac_common.c index f6a470ed2..79a3c38f2 100644 --- a/src/inputPlugins/_flac_common.c +++ b/src/inputPlugins/_flac_common.c @@ -106,14 +106,19 @@ static void flacParseReplayGain(const FLAC__StreamMetadata *block, /* tracknumber is used in VCs, MPD uses "track" ..., all the other * tag names match */ static const char * VORBIS_COMMENT_TRACK_KEY = "tracknumber"; +static const char * VORBIS_COMMENT_DISC_KEY = "discnumber"; static unsigned int commentMatchesAddToTag( const FLAC__StreamMetadata_VorbisComment_Entry * entry, unsigned int itemType, MpdTag ** tag) { - const char * str = (itemType == TAG_ITEM_TRACK) ? - VORBIS_COMMENT_TRACK_KEY : mpdTagItemKeys[itemType]; + const char * str; + 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); int vlen = entry->length - slen - 1; diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index e41c054c0..3bfdb6ce7 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -385,6 +385,10 @@ MpdTag * mp4DataDup(char * file, int * mp4MetadataFound) { addItemToMpdTag(ret, TAG_ITEM_TRACK, value); *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)) { addItemToMpdTag(ret, TAG_ITEM_GENRE, value); *mp4MetadataFound = 1; diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index aa094856e..6881b9c41 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -155,12 +155,17 @@ void ogg_getReplayGainInfo(char ** comments, ReplayGainInfo ** infoPtr) { } static const char * VORBIS_COMMENT_TRACK_KEY = "tracknumber"; +static const char * VORBIS_COMMENT_DISC_KEY = "discnumber"; static inline unsigned int ogg_parseCommentAddToTag(char * comment, unsigned int itemType, MpdTag ** tag) { - const char * needle = (itemType == TAG_ITEM_TRACK) ? - VORBIS_COMMENT_TRACK_KEY : mpdTagItemKeys[itemType]; + const char * needle; + 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); if(strncasecmp(comment, needle, len) == 0 && *(comment+len) == '=') { -- cgit v1.2.3