mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-14 08:15:02 -05:00
[listener/library] Notify listeners about start/finish of library update
This commit is contained in:
parent
0b2ee5a9eb
commit
f81d33701b
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user