diff --git a/src/httpd_daap.c b/src/httpd_daap.c index 22d69f4d..aef2fe0e 100644 --- a/src/httpd_daap.c +++ b/src/httpd_daap.c @@ -666,15 +666,10 @@ get_query_params(struct evkeyvalq *query, int *sort_headers, struct query_params { *sort_headers = 0; param = evhttp_find_header(query, "include-sort-headers"); - if (param) + if (param && (strcmp(param, "1") == 0)) { - if (strcmp(param, "1") == 0) - { - *sort_headers = 1; - DPRINTF(E_DBG, L_DAAP, "Sort headers requested\n"); - } - else - DPRINTF(E_DBG, L_DAAP, "Unknown include-sort-headers param: %s\n", param); + *sort_headers = 1; + DPRINTF(E_SPAM, L_DAAP, "Sort headers requested\n"); } } @@ -1661,7 +1656,8 @@ daap_reply_playlists(struct evhttp_request *req, struct evbuffer *evbuf, char ** memset(&qp, 0, sizeof(struct query_params)); get_query_params(query, NULL, &qp); qp.type = Q_PL; - qp.sort = S_PLAYLIST; + if (qp.sort == S_NONE) + qp.sort = S_PLAYLIST; ret = db_query_start(&qp); if (ret < 0) @@ -1876,15 +1872,22 @@ daap_reply_groups(struct evhttp_request *req, struct evbuffer *evbuf, char **uri param = evhttp_find_header(query, "group-type"); if (strcmp(param, "artists") == 0) { + // Request from Remote may have the form: + // groups?meta=dmap.xxx,dma...&type=music&group-type=artists&sort=album&include-sort-headers=1&query=('...')&session-id=... + // Note: Since grouping by artist and sorting by album is crazy we override tag = "agar"; qp.type = Q_GROUP_ARTISTS; qp.sort = S_ARTIST; } else { + // Request from Remote may have the form: + // groups?meta=dmap.xxx,dma...&type=music&group-type=albums&sort=artist&include-sort-headers=0&query=('...'))&session-id=... + // Sort may also be 'album' tag = "agal"; qp.type = Q_GROUP_ALBUMS; - qp.sort = S_ALBUM; + if (qp.sort == S_NONE) + qp.sort = S_ALBUM; } ret = evbuffer_expand(evbuf, 61);