diff --git a/Jellyfin.Plugin.Tvdb/ScheduledTasks/UpdateTask.cs b/Jellyfin.Plugin.Tvdb/ScheduledTasks/UpdateTask.cs index 22ef592..e486dcb 100644 --- a/Jellyfin.Plugin.Tvdb/ScheduledTasks/UpdateTask.cs +++ b/Jellyfin.Plugin.Tvdb/ScheduledTasks/UpdateTask.cs @@ -110,7 +110,7 @@ public IEnumerable GetDefaultTriggers() /// Gets all items that have been updated. /// /// List of items that have been updated. - private async Task> GetItemsUpdated(CancellationToken cancellationToken) + private async Task> GetItemsUpdated(CancellationToken cancellationToken) { double fromTime = DateTimeOffset.UtcNow.AddHours(MetadataUpdateInHours).ToUnixTimeSeconds(); List allUpdates = new List(); @@ -141,7 +141,7 @@ private async Task> GetItemsUpdated(CancellationToken cancellatio string providerId = MetadataProvider.Tvdb.ToString(); - List toUpdateItems = new List(); + HashSet toUpdateItems = new HashSet(); Dictionary providerIdPair = new Dictionary() { { providerId, string.Empty } }; InternalItemsQuery query = new InternalItemsQuery(); @@ -151,10 +151,7 @@ private async Task> GetItemsUpdated(CancellationToken cancellatio providerIdPair[providerId] = update.RecordId!.Value.ToString(CultureInfo.InvariantCulture); query.HasAnyProviderId = providerIdPair; List itemList = _libraryManager.GetItemList(query); - if (itemList.Count > 0 && !toUpdateItems.Contains(itemList[0])) - { - toUpdateItems.Add(itemList[0]); - } + toUpdateItems.UnionWith(itemList); } return toUpdateItems;