aboutsummaryrefslogtreecommitdiffstats
path: root/src/queue
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-10-27 20:35:40 +0100
committerMax Kellermann <max@duempel.org>2015-10-27 20:35:40 +0100
commit8acf996d90e3be551ebffc98de7248a5bee5b69c (patch)
tree9e38e0b05fa274814c0bbc112bfcef38ecdd1137 /src/queue
parent15e432204e62dd5a1c873af13a679195b9645b0c (diff)
downloadmpd-8acf996d90e3be551ebffc98de7248a5bee5b69c.tar.gz
mpd-8acf996d90e3be551ebffc98de7248a5bee5b69c.tar.xz
mpd-8acf996d90e3be551ebffc98de7248a5bee5b69c.zip
command/queue: add range parameter to plchanges and plchangesposid
Diffstat (limited to 'src/queue')
-rw-r--r--src/queue/QueuePrint.cxx27
-rw-r--r--src/queue/QueuePrint.hxx6
2 files changed, 26 insertions, 7 deletions
diff --git a/src/queue/QueuePrint.cxx b/src/queue/QueuePrint.cxx
index 5ae1a3036..a7298c81f 100644
--- a/src/queue/QueuePrint.cxx
+++ b/src/queue/QueuePrint.cxx
@@ -71,19 +71,36 @@ queue_print_uris(Response &r, Partition &partition, const Queue &queue,
void
queue_print_changes_info(Response &r, Partition &partition, const Queue &queue,
- uint32_t version)
+ uint32_t version,
+ unsigned start, unsigned end)
{
- for (unsigned i = 0; i < queue.GetLength(); i++) {
+ assert(start <= end);
+
+ if (start >= queue.GetLength())
+ return;
+
+ if (end > queue.GetLength())
+ end = queue.GetLength();
+
+ for (unsigned i = start; i < end; i++)
if (queue.IsNewerAtPosition(i, version))
queue_print_song_info(r, partition, queue, i);
- }
}
void
queue_print_changes_position(Response &r, const Queue &queue,
- uint32_t version)
+ uint32_t version,
+ unsigned start, unsigned end)
{
- for (unsigned i = 0; i < queue.GetLength(); i++)
+ assert(start <= end);
+
+ if (start >= queue.GetLength())
+ return;
+
+ if (end > queue.GetLength())
+ end = queue.GetLength();
+
+ for (unsigned i = start; i < end; i++)
if (queue.IsNewerAtPosition(i, version))
r.Format("cpos: %i\nId: %i\n",
i, queue.PositionToId(i));
diff --git a/src/queue/QueuePrint.hxx b/src/queue/QueuePrint.hxx
index 88d28e8ca..461987520 100644
--- a/src/queue/QueuePrint.hxx
+++ b/src/queue/QueuePrint.hxx
@@ -42,11 +42,13 @@ queue_print_uris(Response &r, Partition &partition, const Queue &queue,
void
queue_print_changes_info(Response &r, Partition &partition, const Queue &queue,
- uint32_t version);
+ uint32_t version,
+ unsigned start, unsigned end);
void
queue_print_changes_position(Response &r, const Queue &queue,
- uint32_t version);
+ uint32_t version,
+ unsigned start, unsigned end);
void
queue_find(Response &response, Partition &partition, const Queue &queue,