From 3867fa20c6fd4e319b1ab77ebfa3ed8c68cbcfa7 Mon Sep 17 00:00:00 2001 Message-Id: <3867fa20c6fd4e319b1ab77ebfa3ed8c68cbcfa7.1717006976.git.mdw@distorted.org.uk> From: Mark Wooding Date: Wed, 29 Oct 2008 19:07:52 +0000 Subject: [PATCH] Obsolete playing_random state Organization: Straylight/Edgeware From: Richard Kettlewell --- lib/queue.h | 7 ++++--- server/play.c | 1 - server/server-queue.c | 10 +++++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/queue.h b/lib/queue.h index 6baf916..f62ccac 100644 --- a/lib/queue.h +++ b/lib/queue.h @@ -60,10 +60,11 @@ enum playing_state { /** @brief Track is playing but the server is quitting */ playing_quitting, - /** @brief Track was randomly chosen and has not been played + /** @brief OBSOLETE * - * This is going to become obsolete eventually; it's equivalent to @ref - * playing_unplayed but for tracks with a different origin. + * Formerly this meant a track that was picked at random and has not yet been + * played. This situation is now indicated by @p playing_unplayed and @p + * origin_random (or @p origin_adopted). */ playing_random, diff --git a/server/play.c b/server/play.c index 9a04a98..8b79843 100644 --- a/server/play.c +++ b/server/play.c @@ -492,7 +492,6 @@ static void chosen_random_track(ev_source *ev, return; /* Add the track to the queue */ q = queue_add(track, 0, WHERE_END, origin_random); - q->state = playing_random; D(("picked %p (%s) at random", (void *)q, q->track)); queue_write(); /* Maybe a track can now be played */ diff --git a/server/server-queue.c b/server/server-queue.c index 38af055..779e5e1 100644 --- a/server/server-queue.c +++ b/server/server-queue.c @@ -85,8 +85,16 @@ static void queue_do_read(struct queue_entry *head, const char *path) { /* Fix up origin field as best we can; will be wrong in some cases but * hopefully not too horribly so. */ q->origin = q->submitter ? origin_picked : origin_random; - if(q->state == playing_isscratch) + switch(q->state) { + case playing_isscratch: q->origin = origin_scratch; + break; + case playing_random: + q->state = playing_unplayed; + break; + default: + break; + } } if(head == &qhead && (!q->track -- [mdw]