mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-26 23:25:56 -05:00
[library] Add function to delete playlist by id that directly
invalidates the REST API client caches
This commit is contained in:
parent
3fbe16ac1b
commit
4082f9e215
@ -3581,7 +3581,7 @@ jsonapi_reply_library_playlist_delete(struct httpd_request *hreq)
|
||||
return HTTP_BADREQUEST;
|
||||
}
|
||||
|
||||
db_pl_delete(pl_id);
|
||||
library_playlist_remove_byid(pl_id);
|
||||
|
||||
return HTTP_NOCONTENT;
|
||||
}
|
||||
|
@ -742,6 +742,25 @@ library_playlist_remove(char *virtual_path)
|
||||
return commands_exec_sync(cmdbase, playlist_remove, NULL, virtual_path);
|
||||
}
|
||||
|
||||
int
|
||||
library_playlist_remove_byid(int pl_id)
|
||||
{
|
||||
if (scanning)
|
||||
{
|
||||
DPRINTF(E_INFO, L_LIB, "Scan already running, ignoring request to remove playlist '%d'\n", pl_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
db_pl_delete(pl_id);
|
||||
|
||||
if (handle_deferred_update_notifications())
|
||||
listener_notify(LISTENER_UPDATE | LISTENER_DATABASE);
|
||||
else
|
||||
listener_notify(LISTENER_UPDATE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
library_queue_save(char *path)
|
||||
{
|
||||
|
@ -189,6 +189,9 @@ library_playlist_item_add(const char *vp_playlist, const char *vp_item);
|
||||
int
|
||||
library_playlist_remove(char *virtual_path);
|
||||
|
||||
int
|
||||
library_playlist_remove_byid(int plid);
|
||||
|
||||
int
|
||||
library_queue_save(char *path);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user