aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-02-12 18:41:25 +0100
committerMax Kellermann <max@duempel.org>2012-02-12 18:41:25 +0100
commit01b0d9eb975278a3f8c06ca7de01b8d80519df4a (patch)
tree471eeb3074984401eab3fe151d83db9c6e13f528 /src
parenta7f13d841f5373133e2f38882a2f65208aaf8879 (diff)
downloadmpd-01b0d9eb975278a3f8c06ca7de01b8d80519df4a.tar.gz
mpd-01b0d9eb975278a3f8c06ca7de01b8d80519df4a.tar.xz
mpd-01b0d9eb975278a3f8c06ca7de01b8d80519df4a.zip
db_print: print extra "playlist" object for embedded CUE sheets
This finally enables the new embedded CUE sheet code: when a song file contains a playlist, it is printed in the "lsinfo" output, so clients get to know about this.
Diffstat (limited to '')
-rw-r--r--src/db_print.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/src/db_print.c b/src/db_print.c
index 297a6f3f6..4d7e3f5ef 100644
--- a/src/db_print.c
+++ b/src/db_print.c
@@ -56,12 +56,33 @@ print_visitor_directory(const struct directory *directory, void *data,
return true;
}
+static void
+print_playlist_in_directory(struct client *client,
+ const struct directory *directory,
+ const char *name_utf8)
+{
+ if (directory_is_root(directory))
+ client_printf(client, "playlist: %s\n", name_utf8);
+ else
+ client_printf(client, "playlist: %s/%s\n",
+ directory_get_path(directory), name_utf8);
+}
+
static bool
print_visitor_song(struct song *song, void *data,
G_GNUC_UNUSED GError **error_r)
{
+ assert(song != NULL);
+ assert(song->parent != NULL);
+
struct client *client = data;
song_print_uri(client, song);
+
+ if (song->tag != NULL && song->tag->has_playlist)
+ /* this song file has an embedded CUE sheet */
+ print_playlist_in_directory(client, song->parent,
+ song->uri);
+
return true;
}
@@ -69,21 +90,18 @@ static bool
print_visitor_song_info(struct song *song, void *data,
G_GNUC_UNUSED GError **error_r)
{
+ assert(song != NULL);
+ assert(song->parent != NULL);
+
struct client *client = data;
song_print_info(client, song);
- return true;
-}
-static void
-print_playlist_in_directory(struct client *client,
- const struct directory *directory,
- const char *name_utf8)
-{
- if (directory_is_root(directory))
- client_printf(client, "playlist: %s\n", name_utf8);
- else
- client_printf(client, "playlist: %s/%s\n",
- directory_get_path(directory), name_utf8);
+ if (song->tag != NULL && song->tag->has_playlist)
+ /* this song file has an embedded CUE sheet */
+ print_playlist_in_directory(client, song->parent,
+ song->uri);
+
+ return true;
}
static bool