aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-10-05 17:16:26 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-10-05 17:16:26 +0000
commitcc66392570a0f78eb8fcb21de51fc7b9fc26c604 (patch)
treed250de819e54c6bd514a34f2f2cdde830b6e94bd
parentc21084d9659dd70ca33854316b15d16e26bbde6a (diff)
downloadmpd-cc66392570a0f78eb8fcb21de51fc7b9fc26c604.tar.gz
mpd-cc66392570a0f78eb8fcb21de51fc7b9fc26c604.tar.xz
mpd-cc66392570a0f78eb8fcb21de51fc7b9fc26c604.zip
apply dottemag's id3v1 encodings patch
git-svn-id: https://svn.musicpd.org/mpd/trunk@2163 09075e82-0dd4-0310-85a5-a0d7c8717e4f
-rw-r--r--src/conf.c5
-rw-r--r--src/conf.h1
-rw-r--r--src/tag.c14
3 files changed, 18 insertions, 2 deletions
diff --git a/src/conf.c b/src/conf.c
index 7850c8881..d61d638bf 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -37,7 +37,7 @@
#define CONF_COMMENT '#'
-#define CONF_NUMBER_OF_PARAMS 41
+#define CONF_NUMBER_OF_PARAMS 42
#define CONF_NUMBER_OF_PATHS 6
#define CONF_NUMBER_OF_REQUIRED 5
#define CONF_NUMBER_OF_ALLOW_CATS 1
@@ -137,7 +137,8 @@ char ** readConf(char * file) {
"shout_mount",
"shout_name",
"shout_user",
- "shout_quality"
+ "shout_quality",
+ "id3v1_encoding"
};
int conf_absolutePaths[CONF_NUMBER_OF_PATHS] = {
diff --git a/src/conf.h b/src/conf.h
index 56ea0cc44..d87dc24fc 100644
--- a/src/conf.h
+++ b/src/conf.h
@@ -62,6 +62,7 @@
#define CONF_SHOUT_NAME 38
#define CONF_SHOUT_USER 39
#define CONF_SHOUT_QUALITY 40
+#define CONF_ID3V1_ENCODING 41
#define CONF_CAT_CHAR "\n"
diff --git a/src/tag.c b/src/tag.c
index 6c896c4c6..08b620289 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -23,6 +23,8 @@
#include "utf8.h"
#include "log.h"
#include "inputStream.h"
+#include "conf.h"
+#include "charConv.h"
#include <sys/stat.h>
#include <stdlib.h>
@@ -91,6 +93,18 @@ char * getID3Info(struct id3_tag * tag, char * id) {
utf8 = id3_ucs4_utf8duplicate(ucs4);
if(!utf8) return NULL;
+ if(getConf()[CONF_ID3V1_ENCODING]
+ && (id3_tag_options(tag, 0, 0) & ID3_TAG_OPTION_ID3V1)) {
+
+ char* isostr;
+ setCharSetConversion("ISO-8859-1", "UTF-8");
+ isostr = convStrDup(utf8);
+ free(utf8);
+ setCharSetConversion("UTF-8", getConf()[CONF_ID3V1_ENCODING]);
+ utf8 = convStrDup(isostr);
+ free(isostr);
+ }
+
return utf8;
}
#endif