Merge branch 'raop_enc_md'

This commit is contained in:
ejurgensen 2013-11-23 23:11:42 +01:00
commit 4ffe10994d
4 changed files with 37 additions and 18 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);
}
@ -3716,6 +3715,7 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
char *at_name;
char *password;
uint64_t id;
char wants_metadata;
char has_password;
enum raop_devtype devtype;
int ret;
@ -3850,6 +3850,25 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
devtype = OTHER;
no_am:
wants_metadata = 0;
p = keyval_get(txt, "md");
if (!p)
{
DPRINTF(E_LOG, L_PLAYER, "AirTunes %s: no md field in TXT record!\n", name);
goto no_md;
}
if (*p == '\0')
{
DPRINTF(E_LOG, L_PLAYER, "AirTunes %s: md has no value\n", name);
goto no_md;
}
wants_metadata = 1;
no_md:
DPRINTF(E_DBG, L_PLAYER, "AirTunes device %s: password: %s, type %s\n", name, (password) ? "yes" : "no", raop_devtype[devtype]);
rd->advertised = 1;
@ -3869,6 +3888,7 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
rd->devtype = devtype;
rd->wants_metadata = wants_metadata;
rd->has_password = has_password;
rd->password = password;

View File

@ -1848,31 +1848,28 @@ raop_session_make(struct raop_device *rd, int family, raop_status_cb cb)
rs->server_fd = -1;
rs->password = rd->password;
rs->wants_metadata = rd->wants_metadata;
switch (rd->devtype)
{
case RAOP_DEV_APEX_80211G:
rs->encrypt = 1;
rs->auth_quirk_itunes = 1;
rs->wants_metadata = 0;
break;
case RAOP_DEV_APEX_80211N:
rs->encrypt = 1;
rs->auth_quirk_itunes = 0;
rs->wants_metadata = 0;
break;
case RAOP_DEV_APPLETV:
rs->encrypt = 0;
rs->auth_quirk_itunes = 0;
rs->wants_metadata = 1;
break;
case OTHER:
rs->encrypt = 0;
rs->auth_quirk_itunes = 0;
rs->wants_metadata = 0;
break;
}

View File

@ -40,6 +40,7 @@ struct raop_device
unsigned selected:1;
unsigned advertised:1;
unsigned wants_metadata:1;
unsigned has_password:1;
const char *password;