Fixes two issues with Hyperfine Remote for Android

1. H. Remote uses the playpause command to both play and pause,
but forked-daapd would only support play, not pause.
2. H. Remote sends speaker id's in decimal, not in hex like other
remotes. Fixed so forked-daapd will understand both.
This commit is contained in:
ejurgensen 2013-08-30 21:50:31 +02:00
parent 799fe9e684
commit 83edef0f01

View File

@ -967,19 +967,29 @@ static void
dacp_reply_playpause(struct evhttp_request *req, struct evbuffer *evbuf, char **uri, struct evkeyvalq *query) dacp_reply_playpause(struct evhttp_request *req, struct evbuffer *evbuf, char **uri, struct evkeyvalq *query)
{ {
struct daap_session *s; struct daap_session *s;
struct player_status status;
int ret; int ret;
s = daap_session_find(req, query, evbuf); s = daap_session_find(req, query, evbuf);
if (!s) if (!s)
return; return;
ret = player_playback_start(NULL);
if (ret < 0)
{
DPRINTF(E_LOG, L_DACP, "Player returned an error for start after pause\n");
evhttp_send_error(req, 500, "Internal Server Error"); player_get_status(&status);
return; if (status.status == PLAY_PLAYING)
{
player_playback_pause();
}
else
{
ret = player_playback_start(NULL);
if (ret < 0)
{
DPRINTF(E_LOG, L_DACP, "Player returned an error for start after pause\n");
evhttp_send_error(req, 500, "Internal Server Error");
return;
}
} }
/* 204 No Content is the canonical reply */ /* 204 No Content is the canonical reply */
@ -1502,15 +1512,18 @@ dacp_reply_setspeakers(struct evhttp_request *req, struct evbuffer *evbuf, char
do do
{ {
param++; param++;
ret = safe_hextou64(param, &ids[i]); /* Hyperfine Remote for Android will send in decimal, others use hex */
if (ret < 0) if (safe_atou64(param, &ids[i]) < 0)
{ {
DPRINTF(E_LOG, L_DACP, "Invalid speaker id in request: %s\n", param); ret = safe_hextou64(param, &ids[i]);
if (ret < 0)
{
DPRINTF(E_LOG, L_DACP, "Invalid speaker id in request: %s\n", param);
nspk--; nspk--;
continue; continue;
}
} }
i++; i++;
} }
while ((param = strchr(param + 1, ','))); while ((param = strchr(param + 1, ',')));