Return daap.songalbumid as a hash of the album_artist + album
iPhone remote will later want to query by album. Instead of doing a fulltext query, it uses a 64-bit hash of the album + album_artist. It is not necessary to use the same hash algorithm that iTunes uses. The important thing is that we can later respond to a query=('daap.songalbumid:xxx') with this value.
This commit is contained in:
parent
19a244095a
commit
d3350713d1
|
@ -33,6 +33,7 @@
|
|||
#include <regex.h>
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <event.h>
|
||||
#include "evhttp/evhttp.h"
|
||||
|
@ -175,6 +176,8 @@ static struct dmap_field_map dmap_fields[] =
|
|||
-1, -1 },
|
||||
{ 0, DMAP_TYPE_STRING, "asal", "daap.songalbum",
|
||||
dbmfi_offsetof(album), -1 },
|
||||
{ 0, DMAP_TYPE_LONG, "asai", "daap.songalbumid", /* special case; will be transformed to LONG (hash) */
|
||||
dbmfi_offsetof(album), -1 },
|
||||
{ 0, DMAP_TYPE_STRING, "asar", "daap.songartist",
|
||||
dbmfi_offsetof(artist), -1 },
|
||||
{ 0, DMAP_TYPE_SHORT, "asbt", "daap.songbeatsperminute",
|
||||
|
@ -960,6 +963,7 @@ daap_reply_songlist_generic(struct evhttp_request *req, struct evbuffer *evbuf,
|
|||
char **strval;
|
||||
char *ptr;
|
||||
uint32_t *meta;
|
||||
int64_t songalbumid;
|
||||
int nmeta;
|
||||
int nsongs;
|
||||
int transcode;
|
||||
|
@ -1153,6 +1157,19 @@ daap_reply_songlist_generic(struct evhttp_request *req, struct evbuffer *evbuf,
|
|||
continue;
|
||||
}
|
||||
|
||||
/* Special handling for songalbumid (asai)
|
||||
* Return an int64_t hash of the album_artist & album
|
||||
*/
|
||||
if (strcmp(dfm->tag, "asai") == 0)
|
||||
{
|
||||
songalbumid = daap_songalbumid(dbmfi.album_artist, dbmfi.album);
|
||||
|
||||
dmap_add_long(song, dfm->tag, songalbumid);
|
||||
|
||||
DPRINTF(E_DBG, L_DAAP, "Generated meta tag %s (%" PRIi64 ") based on (%s,%s)\n", dfm->desc, songalbumid, dbmfi.album_artist, dbmfi.album);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (transcode)
|
||||
{
|
||||
switch (dfm->mfi_offset)
|
||||
|
|
Loading…
Reference in New Issue