chiark / gitweb /
Merge branch '5.2.x'
[disorder] / server / schedule.c
index f1b20a123d96433188d70bef0286f60fcf8406c5..520ae2e6e38736b8845e356611f909a7bd742ed3 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of DisOrder
- * Copyright (C) 2008 Richard Kettlewell
+ * Copyright (C) 2008-2010 Richard Kettlewell
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -359,6 +359,7 @@ static void schedule_play(ev_source *ev,
                          const char *who,
                          struct kvp *actiondata) {
   const char *track = kvp_get(actiondata, "track");
+  const char *rtrack = 0;
   struct queue_entry *q;
 
   /* This stuff has rather a lot in common with c_play() */
@@ -370,12 +371,12 @@ static void schedule_play(ev_source *ev,
     disorder_error(0, "scheduled event %s: no such track as %s", id, track);
     return;
   }
-  if(!(track = trackdb_resolve(track))) {
+  if(!(rtrack = trackdb_resolve(track))) {
     disorder_error(0, "scheduled event %s: cannot resolve track %s", id, track);
     return;
   }
-  disorder_info("scheduled event %s: %s play %s", id,  who, track);
-  q = queue_add(track, who, WHERE_START, NULL, origin_scheduled);
+  disorder_info("scheduled event %s: %s play %s", id,  who, rtrack);
+  q = queue_add(rtrack, who, WHERE_START, NULL, origin_scheduled);
   queue_write();
   if(q == qhead.next && playing)
     prepare(ev, q);
@@ -471,14 +472,12 @@ static int schedule_lookup(const char *id,
 static int schedule_trigger(ev_source *ev,
                            const struct timeval attribute((unused)) *now,
                            void *u) {
-  const char *action, *id = u;
+  const char *id = u;
   struct kvp *actiondata = schedule_get(id);
   int n;
 
   if(!actiondata)
     return 0;
-  /* schedule_get() enforces these being present */
-  action = kvp_get(actiondata, "action");
   /* Look up the action */
   n = schedule_lookup(id, actiondata);
   if(n < 0)