Use Distinct() to filter out duplicates when adding items to playlist

This commit is contained in:
Mark Monteiro 2020-03-11 23:26:55 +01:00
parent 487aa376b4
commit d276e0f8f4

View File

@ -202,8 +202,7 @@ namespace Emby.Server.Implementations.Playlists
var existingIds = playlist.LinkedChildren.Select(c => c.ItemId).ToHashSet();
var uniqueItems = items
.Where(i => !existingIds.Contains(i.Id))
.GroupBy(i => i.Id)
.Select(group => group.First())
.Distinct()
.Select(i => LinkedChild.Create(i))
.ToList();