Also account for playqueue-edit?...queuefilter=album:(null)

This commit is contained in:
ejurgensen 2013-11-23 23:05:13 +01:00
parent 1199a459ac
commit c360bdd5bd
2 changed files with 14 additions and 14 deletions

View File

@ -1347,11 +1347,12 @@ dacp_reply_playqueueedit_add(struct evhttp_request *req, struct evbuffer *evbuf,
editquery = evhttp_find_header(query, "query");
if (editquery)
{
/* This query kind needs special treatment */
quirkyquery = (mode == 1) && strstr(editquery, "dmap.itemid:");
sort = evhttp_find_header(query, "sort");
queuefilter = evhttp_find_header(query, "queuefilter");
sort = evhttp_find_header(query, "sort");
/* Detect the quirky query - a query that needs special treatment */
quirkyquery = (mode == 1) && strstr(editquery, "dmap.itemid:") && ((!queuefilter) || strstr(queuefilter, "(null)"));
ret = player_queue_make_daap(&ps, editquery, queuefilter, sort, quirkyquery);
if (ret < 0)
@ -1429,7 +1430,7 @@ dacp_reply_playqueueedit(struct evhttp_request *req, struct evbuffer *evbuf, cha
?command=playnow&index=...&session-id=...
-> play index
And the quirky query - no sort and no queuefilter:
And the quirky query - no sort, and either no queuefilter or queuefilter=album:(null)
User selected track (artist tab):
?command=add&query='dmap.itemid:...'&mode=1&session-id=...
-> clear queue, play itemid and the rest of artist tracks

View File

@ -724,7 +724,15 @@ player_queue_make_daap(struct player_source **head, const char *query, const cha
id = 0;
if (queuefilter)
if (quirk && dbmfi.album_artist)
{
safe_atou32(dbmfi.id, &id);
qp.sort = S_ALBUM;
qp.type = Q_ITEMS;
snprintf(buf, sizeof(buf), "f.album_artist = \"%s\"", db_escape_string(dbmfi.album_artist));
qp.filter = strdup(buf);
}
else if (queuefilter)
{
safe_atou32(dbmfi.id, &id);
if ((strlen(queuefilter) > 6) && (strncmp(queuefilter, "album:", 6) == 0))
@ -760,17 +768,8 @@ player_queue_make_daap(struct player_source **head, const char *query, const cha
return -1;
}
}
else if (quirk && dbmfi.album_artist)
{
safe_atou32(dbmfi.id, &id);
qp.sort = S_ALBUM;
qp.type = Q_ITEMS;
snprintf(buf, sizeof(buf), "f.album_artist = \"%s\"", dbmfi.album_artist);
qp.filter = strdup(buf);
}
else
{
id = 0;
qp.type = Q_ITEMS;
qp.filter = daap_query_parse_sql(query);
}