diff options
author | Max Kellermann <max@duempel.org> | 2011-09-13 22:02:37 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-09-13 22:02:37 +0200 |
commit | c779e2674abbc3eed08e49296c188a9f9ed5270e (patch) | |
tree | 35a3a84bb32f595c7916eda865c38e0b27d38418 /src/db_print.c | |
parent | a94d4be466ea3a48389361b483f72df45834f7d2 (diff) | |
download | mpd-c779e2674abbc3eed08e49296c188a9f9ed5270e.tar.gz mpd-c779e2674abbc3eed08e49296c188a9f9ed5270e.tar.xz mpd-c779e2674abbc3eed08e49296c188a9f9ed5270e.zip |
db_visitor: add method playlist()
Diffstat (limited to 'src/db_print.c')
-rw-r--r-- | src/db_print.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/db_print.c b/src/db_print.c index d398a22ac..8f9bd5b97 100644 --- a/src/db_print.c +++ b/src/db_print.c @@ -72,14 +72,51 @@ print_visitor_song_info(struct song *song, void *data, return true; } +static bool +print_visitor_playlist(const struct playlist_metadata *playlist, void *ctx, + G_GNUC_UNUSED GError **error_r) +{ + struct client *client = ctx; + client_printf(client, "playlist: %s\n", playlist->name); + return true; +} + +static bool +print_visitor_playlist_info(const struct playlist_metadata *playlist, + void *ctx, G_GNUC_UNUSED GError **error_r) +{ + struct client *client = ctx; + client_printf(client, "playlist: %s\n", playlist->name); + +#ifndef G_OS_WIN32 + struct tm tm; +#endif + char timestamp[32]; + time_t t = playlist->mtime; + strftime(timestamp, sizeof(timestamp), +#ifdef G_OS_WIN32 + "%Y-%m-%dT%H:%M:%SZ", + gmtime(&t) +#else + "%FT%TZ", + gmtime_r(&t, &tm) +#endif + ); + client_printf(client, "Last-Modified: %s\n", timestamp); + + return true; +} + static const struct db_visitor print_visitor = { .directory = print_visitor_directory, .song = print_visitor_song, + .playlist = print_visitor_playlist, }; static const struct db_visitor print_info_visitor = { .directory = print_visitor_directory, .song = print_visitor_song_info, + .playlist = print_visitor_playlist_info, }; struct search_data { |