aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-02-12 18:19:12 +0100
committerMax Kellermann <max@duempel.org>2012-02-12 18:29:05 +0100
commit4b36af4a349fb8840b0bb3a9fb30552abbac663f (patch)
tree3928f75ca8b1e8f915f72c958332f13b8a710f25
parent4a23a4bfee5c7b213da4f72ae858ab69840ccbdc (diff)
downloadmpd-4b36af4a349fb8840b0bb3a9fb30552abbac663f.tar.gz
mpd-4b36af4a349fb8840b0bb3a9fb30552abbac663f.tar.xz
mpd-4b36af4a349fb8840b0bb3a9fb30552abbac663f.zip
tag: add attribute "has_playlist"
-rw-r--r--src/song_save.c7
-rw-r--r--src/tag.c2
-rw-r--r--src/tag.h6
-rw-r--r--src/tag_save.c3
4 files changed, 18 insertions, 0 deletions
diff --git a/src/song_save.c b/src/song_save.c
index 0d4c36f99..4fcb46e22 100644
--- a/src/song_save.c
+++ b/src/song_save.c
@@ -100,6 +100,13 @@ song_load(FILE *fp, struct directory *parent, const char *uri,
}
song->tag->time = atoi(value);
+ } else if (strcmp(line, "Playlist") == 0) {
+ if (!song->tag) {
+ song->tag = tag_new();
+ tag_begin_add(song->tag);
+ }
+
+ song->tag->has_playlist = strcmp(value, "yes") == 0;
} else if (strcmp(line, SONG_MTIME) == 0) {
song->mtime = atoi(value);
} else if (strcmp(line, "Range") == 0) {
diff --git a/src/tag.c b/src/tag.c
index 1dffe9c26..c0faa7ab2 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -158,6 +158,7 @@ struct tag *tag_new(void)
struct tag *ret = g_new(struct tag, 1);
ret->items = NULL;
ret->time = -1;
+ ret->has_playlist = false;
ret->num_items = 0;
return ret;
}
@@ -226,6 +227,7 @@ struct tag *tag_dup(const struct tag *tag)
ret = tag_new();
ret->time = tag->time;
+ ret->has_playlist = tag->has_playlist;
ret->num_items = tag->num_items;
ret->items = ret->num_items > 0 ? g_malloc(items_size(tag)) : NULL;
diff --git a/src/tag.h b/src/tag.h
index 530f84c4b..2556cf3a7 100644
--- a/src/tag.h
+++ b/src/tag.h
@@ -88,6 +88,12 @@ struct tag {
*/
int time;
+ /**
+ * Does this file have an embedded playlist (e.g. embedded CUE
+ * sheet)?
+ */
+ bool has_playlist;
+
/** an array of tag items */
struct tag_item **items;
diff --git a/src/tag_save.c b/src/tag_save.c
index efc476e19..2fdaef56c 100644
--- a/src/tag_save.c
+++ b/src/tag_save.c
@@ -28,6 +28,9 @@ void tag_save(FILE *file, const struct tag *tag)
if (tag->time >= 0)
fprintf(file, SONG_TIME "%i\n", tag->time);
+ if (tag->has_playlist)
+ fprintf(file, "Playlist: yes\n");
+
for (unsigned i = 0; i < tag->num_items; i++)
fprintf(file, "%s: %s\n",
tag_item_names[tag->items[i]->type],