disobedience notices rescans
authorRichard Kettlewell <rjk@greenend.org.uk>
Tue, 2 Oct 2007 21:40:55 +0000 (22:40 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Tue, 2 Oct 2007 21:40:55 +0000 (22:40 +0100)
disobedience/log.c
doc/disorder_protocol.5.in
lib/eclient.c
lib/eclient.h
server/trackdb.c

index 45d5a9e..83aa582 100644 (file)
@@ -41,6 +41,7 @@ static void log_removed(void *v, const char *id, const char *user);
 static void log_scratched(void *v, const char *track, const char *user);
 static void log_state(void *v, unsigned long state);
 static void log_volume(void *v, int l, int r);
+static void log_rescanned(void *v);
 
 /** @brief Callbacks for server state monitoring */
 const disorder_eclient_log_callbacks log_callbacks = {
@@ -55,7 +56,8 @@ const disorder_eclient_log_callbacks log_callbacks = {
   log_removed,
   log_scratched,
   log_state,
-  log_volume
+  log_volume,
+  log_rescanned
 };
 
 /** @brief State monitor
@@ -192,6 +194,11 @@ static void log_volume(void attribute((unused)) *v,
   }
 }
 
+/** @brief Called when a rescan completes */
+static void log_rescanned(void attribute((unused)) *v) {
+  added_update();
+}
+
 /** @brief Add a monitor to the list
  * @param callback Function to call
  * @param u User data to pass to @p callback
index 100e746..ef18bb9 100644 (file)
@@ -404,6 +404,9 @@ Removed \fIID\fR from the recently played list.
 Queue entry \fIID\fR was removed.  This is used both for explicit removal (when
 \fIUSER\fR is present) and when playing a track (when it is absent).
 .TP
+.B rescanned
+A rescan completed.
+.TP
 .B scratched \fITRACK\fR \fIUSER\fR
 \fITRACK\fR was scratched by \fIUSER\fR.
 .TP
index 2d57d73..c959d28 100644 (file)
@@ -170,6 +170,7 @@ static void logentry_removed(disorder_eclient *c, int nvec, char **vec);
 static void logentry_scratched(disorder_eclient *c, int nvec, char **vec);
 static void logentry_state(disorder_eclient *c, int nvec, char **vec);
 static void logentry_volume(disorder_eclient *c, int nvec, char **vec);
+static void logentry_rescanned(disorder_eclient *c, int nvec, char **vec);
 
 /* Tables ********************************************************************/
 
@@ -194,6 +195,7 @@ static const struct logentry_handler logentry_handlers[] = {
   LE(recent_added, 2, INT_MAX),
   LE(recent_removed, 1, 1),
   LE(removed, 1, 2),
+  LE(rescanned, 0, 0),
   LE(scratched, 2, 2),
   LE(state, 1, 1),
   LE(volume, 2, 2)
@@ -1309,6 +1311,13 @@ static void logentry_removed(disorder_eclient *c,
   c->log_callbacks->removed(c->log_v, vec[0], vec[1]);
 }
 
+static void logentry_rescanned(disorder_eclient *c,
+                               int attribute((unused)) nvec,
+                               char attribute((unused)) **vec) {
+  if(!c->log_callbacks->rescanned) return;
+  c->log_callbacks->rescanned(c->log_v);
+}
+
 static void logentry_scratched(disorder_eclient *c,
                                int attribute((unused)) nvec, char **vec) {
   if(!c->log_callbacks->scratched) return;
index 47feee3..0ced5de 100644 (file)
@@ -96,6 +96,7 @@ typedef struct disorder_eclient_log_callbacks {
   void (*scratched)(void *v, const char *track, const char *user);
   void (*state)(void *v, unsigned long state);
   void (*volume)(void *v, int left, int right);
+  void (*rescanned)(void *v);
 } disorder_eclient_log_callbacks;
 
 /* State bits */
index 07fdd28..ab5a5e9 100644 (file)
@@ -1748,6 +1748,7 @@ static int reap_rescan(ev_source attribute((unused)) *ev,
     D(("disorderd-rescan terminate: %s", wstat(status)));
   /* Our cache of file lookups is out of date now */
   cache_clean(&cache_files_type);
+  eventlog("rescanned", (char *)0);
   return 0;
 }