diff --git a/src/library.c b/src/library.c index 1d2660d0..8c57f85b 100644 --- a/src/library.c +++ b/src/library.c @@ -549,7 +549,7 @@ rescan(void *arg, int *ret) int i; DPRINTF(E_LOG, L_LIB, "Library rescan triggered\n"); - + listener_notify(LISTENER_UPDATE); starttime = time(NULL); for (i = 0; sources[i]; i++) @@ -569,8 +569,9 @@ rescan(void *arg, int *ret) endtime = time(NULL); DPRINTF(E_LOG, L_LIB, "Library rescan completed in %.f sec\n", difftime(endtime, starttime)); - scanning = false; + listener_notify(LISTENER_UPDATE); + *ret = 0; return COMMAND_END; } @@ -583,7 +584,7 @@ fullrescan(void *arg, int *ret) int i; DPRINTF(E_LOG, L_LIB, "Library full-rescan triggered\n"); - + listener_notify(LISTENER_UPDATE); starttime = time(NULL); player_playback_stop(); @@ -605,8 +606,9 @@ fullrescan(void *arg, int *ret) endtime = time(NULL); DPRINTF(E_LOG, L_LIB, "Library full-rescan completed in %.f sec\n", difftime(endtime, starttime)); - scanning = false; + listener_notify(LISTENER_UPDATE); + *ret = 0; return COMMAND_END; } @@ -665,6 +667,7 @@ initscan() scanning = true; starttime = time(NULL); + listener_notify(LISTENER_UPDATE); // Only clear the queue if enabled (default) in config clear_queue_disabled = cfg_getbool(cfg_getsec(cfg, "mpd"), "clear_queue_on_stop_disable"); @@ -691,7 +694,7 @@ initscan() DPRINTF(E_LOG, L_LIB, "Library init scan completed in %.f sec\n", difftime(endtime, starttime)); scanning = false; - + listener_notify(LISTENER_UPDATE); listener_notify(LISTENER_DATABASE); } diff --git a/src/listener.h b/src/listener.h index 8a557fa9..ae0b995f 100644 --- a/src/listener.h +++ b/src/listener.h @@ -16,8 +16,10 @@ enum listener_event_type LISTENER_OPTIONS = (1 << 4), /* The library has been modified */ LISTENER_DATABASE = (1 << 5), - /* A stored playlist has been modified (create, delete, add, rename) */ + /* A stored playlist has ben modified (create, delete, add, rename) */ LISTENER_STORED_PLAYLIST = (1 << 6), + /* A library update has started or finished */ + LISTENER_UPDATE = (1 << 7), }; typedef void (*notify)(enum listener_event_type type);