[library] Directly notify listeners of db changes after adding new items

This commit is contained in:
chme 2020-11-22 11:08:55 +01:00
parent b8a66a92cf
commit 3fbe16ac1b
1 changed files with 17 additions and 2 deletions

View File

@ -553,6 +553,16 @@ item_add(void *arg, int *retval)
}
}
scanning = false;
if (ret == LIBRARY_OK)
{
if (handle_deferred_update_notifications())
listener_notify(LISTENER_UPDATE | LISTENER_DATABASE);
else
listener_notify(LISTENER_UPDATE);
}
*retval = ret;
return COMMAND_END;
}
@ -762,8 +772,13 @@ library_queue_item_add(const char *path, int position, char reshuffle, uint32_t
int
library_item_add(const char *path)
{
if (library_is_scanning())
if (scanning)
{
DPRINTF(E_INFO, L_LIB, "Scan already running, ignoring request to add item '%s'\n", path);
return -1;
}
scanning = true; // TODO Guard "scanning" with a mutex
return commands_exec_sync(cmdbase, item_add, NULL, (char *)path);
}