aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist_print.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-04 22:09:04 +0100
committerMax Kellermann <max@duempel.org>2009-02-04 22:09:04 +0100
commit2a1bef222555cbc0a84b0c90ccf4309b35e6387b (patch)
treeeec3bc0065e9ccd3e4550516a95f1a00c62ea952 /src/playlist_print.c
parentcbea8a2a00e82ead82fbc3bf968f22c004e80931 (diff)
downloadmpd-2a1bef222555cbc0a84b0c90ccf4309b35e6387b.tar.gz
mpd-2a1bef222555cbc0a84b0c90ccf4309b35e6387b.tar.xz
mpd-2a1bef222555cbc0a84b0c90ccf4309b35e6387b.zip
playlist_print: added wrappers for printing the queue
Hide the details of the playlist behind wrapper functions.
Diffstat (limited to '')
-rw-r--r--src/playlist_print.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/playlist_print.c b/src/playlist_print.c
index c4a9c4f34..05adf5748 100644
--- a/src/playlist_print.c
+++ b/src/playlist_print.c
@@ -17,12 +17,97 @@
*/
#include "playlist_print.h"
+#include "queue_print.h"
#include "stored_playlist.h"
#include "song_print.h"
#include "song.h"
#include "database.h"
#include "client.h"
+void
+playlist_print_uris(struct client *client, const struct playlist *playlist)
+{
+ const struct queue *queue = &playlist->queue;
+
+ queue_print_uris(client, queue, 0, queue_length(queue));
+}
+
+bool
+playlist_print_info(struct client *client, const struct playlist *playlist,
+ unsigned start, unsigned end)
+{
+ const struct queue *queue = &playlist->queue;
+
+ if (end > queue_length(queue))
+ /* correct the "end" offset */
+ end = queue_length(queue);
+
+ if (start > end)
+ /* an invalid "start" offset is fatal */
+ return false;
+
+ queue_print_info(client, queue, start, end);
+ return true;
+}
+
+bool
+playlist_print_id(struct client *client, const struct playlist *playlist,
+ unsigned id)
+{
+ const struct queue *queue = &playlist->queue;
+ int position;
+
+ position = queue_id_to_position(queue, id);
+ if (position < 0)
+ /* no such song */
+ return false;
+
+ return playlist_print_info(client, playlist, position, position + 1);
+}
+
+bool
+playlist_print_current(struct client *client, const struct playlist *playlist)
+{
+ int current_position = getPlaylistCurrentSong(playlist);
+
+ if (current_position < 0)
+ return false;
+
+ queue_print_info(client, &playlist->queue,
+ current_position, current_position + 1);
+ return true;
+}
+
+void
+playlist_print_find(struct client *client, const struct playlist *playlist,
+ const struct locate_item_list *list)
+{
+ queue_find(client, &playlist->queue, list);
+}
+
+void
+playlist_print_search(struct client *client, const struct playlist *playlist,
+ const struct locate_item_list *list)
+{
+ queue_search(client, &playlist->queue, list);
+}
+
+void
+playlist_print_changes_info(struct client *client,
+ const struct playlist *playlist,
+ uint32_t version)
+{
+ queue_print_changes_info(client, &playlist->queue, version);
+}
+
+void
+playlist_print_changes_position(struct client *client,
+ const struct playlist *playlist,
+ uint32_t version)
+{
+ queue_print_changes_position(client, &playlist->queue, version);
+}
+
bool
spl_print(struct client *client, const char *name_utf8, bool detail)
{