Fixed a bug where media files associated with multiple artists or albums were returned multiple times.

This commit is contained in:
Jonathan Bernard 2016-03-16 05:53:14 -05:00
parent d2ed22d229
commit 8e145b244d

View File

@ -423,7 +423,7 @@ public class DbApi {
def whereClauses = [] def whereClauses = []
def newJoin def newJoin
query.append('SELECT mf.* FROM media_files mf ') query.append('SELECT DISTINCT * FROM (SELECT mf.* FROM media_files mf ')
if (params.artistId || params.playlistId) { if (params.artistId || params.playlistId) {
joins << (newJoin = [ joins << (newJoin = [
@ -501,7 +501,7 @@ public class DbApi {
if (orderClauses) if (orderClauses)
query.append(' ORDER BY ').append(orderClauses.join(', ')) query.append(' ORDER BY ').append(orderClauses.join(', '))
query = query.toString() query = query.append(') as filtered_sorted_media_files').toString()
logger.debug('Selecting media files.\n\tSQL: {}\n\tPARAMS: {}', logger.debug('Selecting media files.\n\tSQL: {}\n\tPARAMS: {}',
query, sqlParams) query, sqlParams)
return sql.rows(query, sqlParams).collect { return sql.rows(query, sqlParams).collect {