Maintain songalbumid inside the files table

songalbumid is used a lot in queries from Remote; computing the hash for
each row is a major waste of time on big libraries and slow machines, so
let's store the hash in the table.

This brings us to schema version 7.
This commit is contained in:
Julien BLACHE
2010-03-06 17:13:56 +01:00
parent 20c57d5289
commit 748cca63be
4 changed files with 25 additions and 29 deletions

View File

@@ -347,8 +347,8 @@ static struct dmap_field_map dmap_fields[] =
-1, -1, -1 },
{ 0, &dmap_asal,
dbmfi_offsetof(album), -1, -1 },
{ 0, &dmap_asai, /* special case; will be transformed to LONG (hash) */
dbmfi_offsetof(album), -1, -1 },
{ 0, &dmap_asai,
dbmfi_offsetof(songalbumid), -1, -1 },
{ 0, &dmap_asaa,
dbmfi_offsetof(album_artist), -1, dbgri_offsetof(songalbumartist) },
{ 0, &dmap_asar,
@@ -1305,7 +1305,6 @@ 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;
@@ -1486,19 +1485,6 @@ 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 (dfm->field == &dmap_asai)
{
songalbumid = daap_songalbumid(dbmfi.album_artist, dbmfi.album);
dmap_add_long(song, dfm->field->tag, songalbumid);
DPRINTF(E_DBG, L_DAAP, "Generated meta tag %s (%" PRIi64 ") based on (%s,%s)\n", dfm->field->desc, songalbumid, dbmfi.album_artist, dbmfi.album);
continue;
}
val = 0;
if (transcode)