aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Alexander Treuman <jat@spatialrift.net>2006-06-21 20:52:51 +0000
committerJ. Alexander Treuman <jat@spatialrift.net>2006-06-21 20:52:51 +0000
commit18306dfbd36d2d8bd13fc39eea0a3b703f2481ec (patch)
tree9978f211b72b6ecb2fa16c07d6d55483bce3c3bd
parent9e393393e0b5ca1b2c85664b2a5f8e36d199a269 (diff)
downloadmpd-18306dfbd36d2d8bd13fc39eea0a3b703f2481ec.tar.gz
mpd-18306dfbd36d2d8bd13fc39eea0a3b703f2481ec.tar.xz
mpd-18306dfbd36d2d8bd13fc39eea0a3b703f2481ec.zip
Add back the id3v1_encoding option. Now it really will convert id3v1 only.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4282 09075e82-0dd4-0310-85a5-a0d7c8717e4f
-rw-r--r--doc/mpdconf.example4
-rw-r--r--src/conf.c2
-rw-r--r--src/conf.h1
-rw-r--r--src/tag.c14
4 files changed, 21 insertions, 0 deletions
diff --git a/doc/mpdconf.example b/doc/mpdconf.example
index e1bd5e955..2ed505baf 100644
--- a/doc/mpdconf.example
+++ b/doc/mpdconf.example
@@ -200,6 +200,10 @@ pid_file "~/.mpd/mpd.pid"
#
#port "6600"
#
+# This determines what encoding ID3v1 tags should be converted from.
+#
+#id3v1_encoding "ISO-8859-1"
+#
# This sets the metadata mpd will use, to disable all metadata, set to "none"
# NOTE: comments are disabled by default
#
diff --git a/src/conf.c b/src/conf.c
index db8c9f7b9..0f197dabc 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -119,6 +119,7 @@ void finishConf() {
void initConf() {
configEntriesList = makeList((ListFreeDataFunc *)freeConfigEntry, 1);
+ /* registerConfigParam(name, repeatable, block); */
registerConfigParam(CONF_PORT, 0, 0);
registerConfigParam(CONF_PID_FILE, 0, 0);
registerConfigParam(CONF_MUSIC_DIR, 0, 0);
@@ -155,6 +156,7 @@ void initConf() {
registerConfigParam(CONF_HTTP_PREBUFFER_SIZE, 0, 0);
registerConfigParam(CONF_REPLAYGAIN_PREAMP, 0, 0);
registerConfigParam(CONF_METADATA_TO_USE, 0, 0);
+ registerConfigParam(CONF_ID3V1_ENCODING, 0, 0);
}
static void addBlockParam(ConfigParam * param, char * name, char * value,
diff --git a/src/conf.h b/src/conf.h
index f5cc4bc38..864cf1f66 100644
--- a/src/conf.h
+++ b/src/conf.h
@@ -57,6 +57,7 @@
#define CONF_HTTP_BUFFER_SIZE "http_buffer_size"
#define CONF_HTTP_PREBUFFER_SIZE "http_prebuffer_size"
#define CONF_METADATA_TO_USE "metadata_to_use"
+#define CONF_ID3V1_ENCODING "id3v1_encoding"
typedef struct _BlockParam {
char * name;
diff --git a/src/tag.c b/src/tag.c
index aaf9a2d57..44a174c33 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -138,6 +138,8 @@ MpdTag * getID3Info(struct id3_tag * tag, char * id, int type, MpdTag * mpdTag)
union id3_field const * field;
unsigned int nstrings;
int i;
+ char * isostr;
+ char * encoding;
frame = id3_tag_findframe(tag, id, 0);
if(!frame || frame->nfields < 2) return mpdTag;
@@ -154,6 +156,18 @@ MpdTag * getID3Info(struct id3_tag * tag, char * id, int type, MpdTag * mpdTag)
utf8 = id3_ucs4_utf8duplicate(ucs4);
if(!utf8) continue;
+ if(isId3v1(tag)) {
+ encoding = getConfigParamValue(CONF_ID3V1_ENCODING);
+ if(encoding) {
+ setCharSetConversion("ISO-8859-1", "UTF-8");
+ isostr = convStrDup(utf8);
+ free(utf8);
+ setCharSetConversion("UTF-8", encoding);
+ utf8 = convStrDup(isostr);
+ free(isostr);
+ }
+ }
+
if(mpdTag == NULL) mpdTag = newMpdTag();
addItemToMpdTag(mpdTag, type, utf8);