aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-11-11 21:43:39 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-11-11 21:43:39 +0000
commit76addf155e061ac5703e8bf57fea1f31f830a2a5 (patch)
treee8f49b35583cfc7877d672b51b189067171f2a58 /src/tag.c
parent169079c50129b2e516ed3ae667a29b5d00012111 (diff)
downloadmpd-76addf155e061ac5703e8bf57fea1f31f830a2a5.tar.gz
mpd-76addf155e061ac5703e8bf57fea1f31f830a2a5.tar.xz
mpd-76addf155e061ac5703e8bf57fea1f31f830a2a5.zip
ok, dottemag's id3v1_encoding config parameter should now work.
dottemag can you test it? i made one little tweak git-svn-id: https://svn.musicpd.org/mpd/trunk@2620 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/tag.c')
-rw-r--r--src/tag.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/tag.c b/src/tag.c
index 22d8cf206..ab32445f8 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -54,6 +54,7 @@ char * mpdTagItemKeys[TAG_NUM_OF_ITEM_TYPES] =
};
static mpd_sint8 ignoreTagItems[TAG_NUM_OF_ITEM_TYPES];
+static char * id3v1_encoding = NULL;
void initTagConfig() {
int quit = 0;
@@ -62,6 +63,11 @@ void initTagConfig() {
char * c;
ConfigParam * param;
int i;
+
+ param = getConfigParam(CONF_ID3V1_ENCODING);
+ if(param) id3v1_encoding = param->value;
+
+ /* parse the "metadata_to_use" config parameter below */
memset(ignoreTagItems, 0, TAG_NUM_OF_ITEM_TYPES);
@@ -115,6 +121,7 @@ MpdTag * getID3Info(struct id3_tag * tag, char * id, int type, MpdTag * mpdTag)
struct id3_frame const * frame;
id3_ucs4_t const * ucs4;
id3_utf8_t * utf8;
+ id3_latin1_t * latin1;
union id3_field const * field;
unsigned int nstrings;
int i;
@@ -133,7 +140,18 @@ MpdTag * getID3Info(struct id3_tag * tag, char * id, int type, MpdTag * mpdTag)
ucs4 = id3_genre_name(ucs4);
}
- utf8 = id3_ucs4_utf8duplicate(ucs4);
+ if(id3v1_encoding &&
+ (id3_tag_options(tag, 0, 0) & ID3_TAG_OPTION_ID3V1))
+ {
+ latin1 = id3_ucs4_latin1duplicate(ucs4);
+ if(!latin1) continue;
+
+ setCharSetConversion("UTF-8", id3v1_encoding);
+ utf8 = convStrDup(latin1);
+ free(latin1);
+ }
+ else utf8 = id3_ucs4_utf8duplicate(ucs4);
+
if(!utf8) continue;
if( NULL == mpdTag ) mpdTag = newMpdTag();