aboutsummaryrefslogtreecommitdiffstats
path: root/src/db_print.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-10-08 14:33:41 +0200
committerMax Kellermann <max@duempel.org>2011-10-08 14:51:18 +0200
commit49b84f92293e2cfc7966dc0f8b50b24c52061b9d (patch)
tree698d180c6e90e57e5e4b298b4dc3c2ace3c238fd /src/db_print.c
parentb43bf4dd741f81239c7ae0c99a048ef0be6286ed (diff)
downloadmpd-49b84f92293e2cfc7966dc0f8b50b24c52061b9d.tar.gz
mpd-49b84f92293e2cfc7966dc0f8b50b24c52061b9d.tar.xz
mpd-49b84f92293e2cfc7966dc0f8b50b24c52061b9d.zip
db_print: print absolute URI of playlist entries
The protocol mandates that playlist URIs are absolute (i.e. full URI relative to the music directory, not relative to the parent directory). This adds the parameter "directory" to the "playlist" visitor method.
Diffstat (limited to 'src/db_print.c')
-rw-r--r--src/db_print.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/db_print.c b/src/db_print.c
index f341ca4e8..067d1c60f 100644
--- a/src/db_print.c
+++ b/src/db_print.c
@@ -73,21 +73,35 @@ print_visitor_song_info(struct song *song, 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_playlist(const struct playlist_metadata *playlist, void *ctx,
+print_visitor_playlist(const struct playlist_metadata *playlist,
+ const struct directory *directory, void *ctx,
G_GNUC_UNUSED GError **error_r)
{
struct client *client = ctx;
- client_printf(client, "playlist: %s\n", playlist->name);
+ print_playlist_in_directory(client, directory, playlist->name);
return true;
}
static bool
print_visitor_playlist_info(const struct playlist_metadata *playlist,
+ const struct directory *directory,
void *ctx, G_GNUC_UNUSED GError **error_r)
{
struct client *client = ctx;
- client_printf(client, "playlist: %s\n", playlist->name);
+ print_playlist_in_directory(client, directory, playlist->name);
#ifndef G_OS_WIN32
struct tm tm;