mirror of
https://github.com/owntone/owntone-server.git
synced 2025-03-20 04:24:20 -04:00
[rsp] Filter out non-file sources since they can't be played
This commit is contained in:
parent
8bba3ee913
commit
24e3ac1a80
@ -44,7 +44,6 @@
|
|||||||
#define RSP_VERSION "1.0"
|
#define RSP_VERSION "1.0"
|
||||||
#define RSP_XML_ROOT "?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?"
|
#define RSP_XML_ROOT "?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?"
|
||||||
|
|
||||||
|
|
||||||
#define F_FULL (1 << 0)
|
#define F_FULL (1 << 0)
|
||||||
#define F_BROWSE (1 << 1)
|
#define F_BROWSE (1 << 1)
|
||||||
#define F_ID (1 << 2)
|
#define F_ID (1 << 2)
|
||||||
@ -57,6 +56,8 @@ struct field_map {
|
|||||||
int flags;
|
int flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static char rsp_filter_files[32];
|
||||||
|
|
||||||
static const struct field_map pl_fields[] =
|
static const struct field_map pl_fields[] =
|
||||||
{
|
{
|
||||||
{ "id", dbpli_offsetof(id), F_ALWAYS },
|
{ "id", dbpli_offsetof(id), F_ALWAYS },
|
||||||
@ -249,6 +250,11 @@ query_params_set(struct query_params *qp, struct httpd_request *hreq)
|
|||||||
if (!qp->filter)
|
if (!qp->filter)
|
||||||
DPRINTF(E_LOG, L_RSP, "Ignoring improper RSP query\n");
|
DPRINTF(E_LOG, L_RSP, "Ignoring improper RSP query\n");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Default filter is to include only files (not streams and Spotify)
|
||||||
|
qp->filter = strdup(rsp_filter_files);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -318,7 +324,7 @@ rsp_reply_info(struct httpd_request *hreq)
|
|||||||
char *library;
|
char *library;
|
||||||
uint32_t songcount;
|
uint32_t songcount;
|
||||||
|
|
||||||
db_files_get_count(&songcount, NULL, NULL);
|
db_files_get_count(&songcount, NULL, rsp_filter_files);
|
||||||
|
|
||||||
lib = cfg_getsec(cfg, "library");
|
lib = cfg_getsec(cfg, "library");
|
||||||
library = cfg_getstr(lib, "name");
|
library = cfg_getstr(lib, "name");
|
||||||
@ -871,6 +877,8 @@ rsp_init(void)
|
|||||||
int i;
|
int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
snprintf(rsp_filter_files, sizeof(rsp_filter_files), "f.data_kind = %d", DATA_KIND_FILE);
|
||||||
|
|
||||||
for (i = 0; rsp_handlers[i].handler; i++)
|
for (i = 0; rsp_handlers[i].handler; i++)
|
||||||
{
|
{
|
||||||
ret = regcomp(&rsp_handlers[i].preg, rsp_handlers[i].regexp, REG_EXTENDED | REG_NOSUB);
|
ret = regcomp(&rsp_handlers[i].preg, rsp_handlers[i].regexp, REG_EXTENDED | REG_NOSUB);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user