summaryrefslogtreecommitdiff
path: root/playlist.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-03-27 13:30:08 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-03-27 13:30:08 +0100
commit96f84bde3845492e390814c9e97a699c141b7566 (patch)
tree0a9414a9d02e10a93132b3c279e260c53053a874 /playlist.c
parentb83cbe27c1bdb55133ef581fdbaf98b1283fa621 (diff)
allow storing any metadata types in playlist
Diffstat (limited to 'playlist.c')
-rw-r--r--playlist.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/playlist.c b/playlist.c
index 5f6f2d0c..07c864e7 100644
--- a/playlist.c
+++ b/playlist.c
@@ -1371,6 +1371,7 @@ pl_item_free (playItem_t *it) {
while (it->meta) {
DB_metaInfo_t *m = it->meta;
it->meta = m->next;
+ metacache_remove_string (m->key);//free (m->key);
metacache_remove_string (m->value);//free (m->value);
free (m);
}
@@ -1432,8 +1433,8 @@ pl_add_meta (playItem_t *it, const char *key, const char *value) {
}
}
m = malloc (sizeof (DB_metaInfo_t));
- m->key = key;
- m->value = metacache_add_string (value);//strdup (value);
+ m->key = metacache_add_string (key); //key;
+ m->value = metacache_add_string (value); //strdup (value);
m->next = it->meta;
it->meta = m;
UNLOCK;
@@ -1832,6 +1833,7 @@ pl_load (const char *fname) {
for (int i = 0; i < nm; i++) {
char key[1024];
char value[1024];
+#if 0
const char *valid_keys[] = {
"title",
"artist",
@@ -1846,6 +1848,7 @@ pl_load (const char *fname) {
"copyright",
NULL
};
+#endif
if (fread (&l, 1, 2, fp) != 2) {
goto load_fail;
@@ -1870,12 +1873,15 @@ pl_load (const char *fname) {
}
value[l] = 0;
//printf ("%s=%s\n", key, value);
+ pl_add_meta (it, key, value);
+#if 0
for (int n = 0; valid_keys[n]; n++) {
if (!strcmp (valid_keys[n], key)) {
pl_add_meta (it, valid_keys[n], value);
break;
}
}
+#endif
}
}
pl_insert_item (playlist->tail[PL_MAIN], it);
@@ -1990,6 +1996,7 @@ pl_delete_all_meta (playItem_t *it) {
while (it->meta) {
DB_metaInfo_t *m = it->meta;
it->meta = m->next;
+ metacache_remove_string (m->key);
metacache_remove_string (m->value);
free (m);
}