Add support for artist group request (experimental)

The purpose of this is mainly to support Hyperfine Remote for Android
This commit is contained in:
ejurgensen
2013-08-29 22:00:37 +02:00
parent 799fe9e684
commit 95fc525beb
6 changed files with 81 additions and 25 deletions

View File

@@ -1515,6 +1515,7 @@ daap_reply_groups(struct evhttp_request *req, struct evbuffer *evbuf, char **uri
struct sort_ctx *sctx;
const char *param;
char **strval;
int group_type;
int nmeta;
int sort_headers;
int ngrp;
@@ -1527,8 +1528,17 @@ daap_reply_groups(struct evhttp_request *req, struct evbuffer *evbuf, char **uri
if (!s)
return;
/* For now we only support album groups */
tag = "agal";
param = evhttp_find_header(query, "group-type");
if (strcmp(param, "artists") == 0)
{
tag = "agar";
group_type = Q_GROUP_ARTISTS;
}
else
{
tag = "agal";
group_type = Q_GROUP_ALBUMS;
}
ret = evbuffer_expand(evbuf, 61);
if (ret < 0)
@@ -1595,7 +1605,7 @@ daap_reply_groups(struct evhttp_request *req, struct evbuffer *evbuf, char **uri
memset(&qp, 0, sizeof(struct query_params));
get_query_params(query, &sort_headers, &qp);
qp.type = Q_GROUPS;
qp.type = group_type;
sctx = NULL;
if (sort_headers)
@@ -1669,8 +1679,9 @@ daap_reply_groups(struct evhttp_request *req, struct evbuffer *evbuf, char **uri
if ((ret == 0) && (val > 0))
dmap_add_int(group, "mimc", val);
/* Song album artist, always added (asaa) */
dmap_add_string(group, "asaa", dbgri.songalbumartist);
/* Song album artist (asaa), always added if group-type is albums */
if (group_type == Q_GROUP_ALBUMS)
dmap_add_string(group, "asaa", dbgri.songalbumartist);
/* Item id (miid) */
val = 0;