[rsp] Interpret artist in queries as album_artist (fixes #1263)

This commit is contained in:
ejurgensen 2021-06-07 20:22:36 +02:00
parent 2e831569a2
commit e18969ef75
2 changed files with 18 additions and 3 deletions

View File

@ -210,6 +210,7 @@ static int
query_params_set(struct query_params *qp, struct httpd_request *hreq) query_params_set(struct query_params *qp, struct httpd_request *hreq)
{ {
const char *param; const char *param;
char query[1024];
char *filter; char *filter;
int ret; int ret;
@ -245,9 +246,24 @@ query_params_set(struct query_params *qp, struct httpd_request *hreq)
param = evhttp_find_header(hreq->query, "query"); param = evhttp_find_header(hreq->query, "query");
if (param) if (param)
{ {
DPRINTF(E_DBG, L_RSP, "RSP browse query filter: %s\n", param); ret = snprintf(query, sizeof(query), "%s", param);
if (ret < 0 || ret >= sizeof(query))
{
DPRINTF(E_LOG, L_RSP, "RSP query is too large for buffer: %s\n", param);
return -1;
}
qp->filter = rsp_query_parse_sql(param); // This is hack to work around the fact that we return album artists in
// the artist lists, but the query from the speaker will just be artist.
// It would probably be better to do this in the RSP lexer/parser.
ret = safe_snreplace(query, sizeof(query), "artist=\"", "album_artist=\"");
if (ret < 0)
{
DPRINTF(E_LOG, L_RSP, "RSP query is too large for buffer: %s\n", param);
return -1;
}
qp->filter = rsp_query_parse_sql(query);
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");
} }

View File

@ -125,7 +125,6 @@ rsp_query_parse_sql(const char *rsp_query)
if (sql) if (sql)
{ {
DPRINTF(E_DBG, L_RSP, "RSP SQL query: -%s-\n", sql->chars);
ret = strdup((char *)sql->chars); ret = strdup((char *)sql->chars);
} }
else else