switch to ExcludeArtistIds

This commit is contained in:
Luke Pulverenti
2016-07-22 18:10:39 -04:00
parent df5cfc0c25
commit 7475722ecf
6 changed files with 20 additions and 16 deletions

View File

@@ -2883,15 +2883,19 @@ namespace MediaBrowser.Server.Implementations.Persistence
whereClauses.Add(clause);
}
if (query.ExcludeArtistNames.Length > 0)
if (query.ExcludeArtistIds.Length > 0)
{
var clauses = new List<string>();
var index = 0;
foreach (var artist in query.ExcludeArtistNames)
foreach (var artistId in query.ExcludeArtistIds)
{
clauses.Add("@ExcludeArtistName" + index + " not in (select CleanValue from itemvalues where ItemId=Guid and Type <= 1)");
cmd.Parameters.Add(cmd, "@ExcludeArtistName" + index, DbType.String).Value = artist.RemoveDiacritics();
index++;
var artistItem = RetrieveItem(new Guid(artistId));
if (artistItem != null)
{
clauses.Add("@ExcludeArtistName" + index + " not in (select CleanValue from itemvalues where ItemId=Guid and Type <= 1)");
cmd.Parameters.Add(cmd, "@ExcludeArtistName" + index, DbType.String).Value = artistItem.Name.RemoveDiacritics();
index++;
}
}
var clause = "(" + string.Join(" AND ", clauses.ToArray()) + ")";
whereClauses.Add(clause);