summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-04-02 16:06:07 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-04-02 16:07:54 +0200
commita5ad305f67147af0bf36f69a37f61fe68c4f3486 (patch)
tree69b12a2143ed0bc55d764a44e1e715592d45d7e0 /plugins
parent7ec3235e5d25c615ed720591961697712653f8be (diff)
added charset detection / utf8 conversion to adplug plugin
Diffstat (limited to 'plugins')
-rw-r--r--plugins/adplug/adplug-db.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/plugins/adplug/adplug-db.cpp b/plugins/adplug/adplug-db.cpp
index 5a285ef4..b97a42da 100644
--- a/plugins/adplug/adplug-db.cpp
+++ b/plugins/adplug/adplug-db.cpp
@@ -209,6 +209,20 @@ adplug_get_extension (const char *fname) {
return "adplug-unknown";
}
+static void
+adplug_add_meta (DB_playItem_t *it, const char *key, const char *value) {
+ if (!value) {
+ return;
+ }
+ const char *charset = deadbeef->junk_detect_charset (value);
+ if (charset) {
+ int l = strlen (value);
+ char str[1024];
+ deadbeef->junk_recode (value, l, str, sizeof (str), charset);
+ deadbeef->pl_add_meta (it, key, str);
+ }
+}
+
DB_playItem_t *
adplug_insert (DB_playItem_t *after, const char *fname) {
// read information from the track
@@ -235,16 +249,16 @@ adplug_insert (DB_playItem_t *after, const char *fname) {
deadbeef->pl_set_item_duration (it, p->songlength (i)/1000.f);
// add metainfo
if (!p->gettitle().empty()) {
- deadbeef->pl_add_meta (it, "title", p->gettitle().c_str());
+ adplug_add_meta (it, "title", p->gettitle().c_str());
}
else {
- deadbeef->pl_add_meta (it, "title", NULL);
+ adplug_add_meta (it, "title", NULL);
}
if (!p->getdesc().empty()) {
- deadbeef->pl_add_meta (it, "comment", p->getdesc().c_str());
+ adplug_add_meta (it, "comment", p->getdesc().c_str());
}
if (!p->getauthor().empty()) {
- deadbeef->pl_add_meta (it, "artist", p->getauthor().c_str());
+ adplug_add_meta (it, "artist", p->getauthor().c_str());
}
// insert
after = deadbeef->pl_insert_item (after, it);