From ec2637285d4a21e60b57a783e33e72778dc0d171 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Mon, 16 Dec 2013 22:29:47 +0100 Subject: [PATCH] In group?group-type=artists type queries return better persistent id - this is a temporary solution until real persistent id's can be used. This change uses a hash of album_artist instead of returning a fixed value of 1. Thank you SquallyDoc, author of Retune, for helping out with this and suggesting this solution. --- src/db.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/db.c b/src/db.c index d9697c2e..673ca048 100644 --- a/src/db.c +++ b/src/db.c @@ -1106,13 +1106,13 @@ db_build_query_group_artists(struct query_params *qp, char **q) sort = sort_clause[qp->sort]; if (idx && qp->filter) - query = sqlite3_mprintf("SELECT 1, 1, f.album_artist, COUNT(*), COUNT(DISTINCT f.album), f.album_artist FROM files f WHERE f.disabled = 0 AND %s GROUP BY f.album_artist %s %s;", qp->filter, sort, idx); + query = sqlite3_mprintf("SELECT 1, daap_songalbumid(f.album_artist, ''), f.album_artist, COUNT(*), COUNT(DISTINCT f.album), f.album_artist FROM files f WHERE f.disabled = 0 AND %s GROUP BY f.album_artist %s %s;", qp->filter, sort, idx); else if (idx) - query = sqlite3_mprintf("SELECT 1, 1, f.album_artist, COUNT(*), COUNT(DISTINCT f.album), f.album_artist FROM files f WHERE f.disabled = 0 GROUP BY f.album_artist %s %s;", sort, idx); + query = sqlite3_mprintf("SELECT 1, daap_songalbumid(f.album_artist, ''), f.album_artist, COUNT(*), COUNT(DISTINCT f.album), f.album_artist FROM files f WHERE f.disabled = 0 GROUP BY f.album_artist %s %s;", sort, idx); else if (qp->filter) - query = sqlite3_mprintf("SELECT 1, 1, f.album_artist, COUNT(*), COUNT(DISTINCT f.album), f.album_artist FROM files f WHERE f.disabled = 0 AND %s GROUP BY f.album_artist %s;", qp->filter, sort); + query = sqlite3_mprintf("SELECT 1, daap_songalbumid(f.album_artist, ''), f.album_artist, COUNT(*), COUNT(DISTINCT f.album), f.album_artist FROM files f WHERE f.disabled = 0 AND %s GROUP BY f.album_artist %s;", qp->filter, sort); else - query = sqlite3_mprintf("SELECT 1, 1, f.album_artist, COUNT(*), COUNT(DISTINCT f.album), f.album_artist FROM files f WHERE f.disabled = 0 GROUP BY f.album_artist %s;", sort); + query = sqlite3_mprintf("SELECT 1, daap_songalbumid(f.album_artist, ''), f.album_artist, COUNT(*), COUNT(DISTINCT f.album), f.album_artist FROM files f WHERE f.disabled = 0 GROUP BY f.album_artist %s;", sort); if (!query) {