From e025abff5284ede4e6927af6b702b6813f42f8d0 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Tue, 2 Oct 2007 22:40:55 +0100 Subject: [PATCH] disobedience notices rescans Organization: Straylight/Edgeware From: Richard Kettlewell --- disobedience/log.c | 9 ++++++++- doc/disorder_protocol.5.in | 3 +++ lib/eclient.c | 9 +++++++++ lib/eclient.h | 1 + server/trackdb.c | 1 + 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/disobedience/log.c b/disobedience/log.c index 45d5a9e..83aa582 100644 --- a/disobedience/log.c +++ b/disobedience/log.c @@ -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 diff --git a/doc/disorder_protocol.5.in b/doc/disorder_protocol.5.in index 100e746..ef18bb9 100644 --- a/doc/disorder_protocol.5.in +++ b/doc/disorder_protocol.5.in @@ -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 diff --git a/lib/eclient.c b/lib/eclient.c index 2d57d73..c959d28 100644 --- a/lib/eclient.c +++ b/lib/eclient.c @@ -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; diff --git a/lib/eclient.h b/lib/eclient.h index 47feee3..0ced5de 100644 --- a/lib/eclient.h +++ b/lib/eclient.h @@ -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 */ diff --git a/server/trackdb.c b/server/trackdb.c index 07fdd28..ab5a5e9 100644 --- a/server/trackdb.c +++ b/server/trackdb.c @@ -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; } -- [mdw]