Skip to content

Commit

Permalink
Update all items returned from GetItemList (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
scampower3 authored Sep 3, 2024
1 parent 8a245d3 commit 35fe6fa
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Jellyfin.Plugin.Tvdb/ScheduledTasks/UpdateTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
/// Gets all items that have been updated.
/// </summary>
/// <returns>List of items that have been updated.</returns>
private async Task<List<BaseItem>> GetItemsUpdated(CancellationToken cancellationToken)
private async Task<HashSet<BaseItem>> GetItemsUpdated(CancellationToken cancellationToken)
{
double fromTime = DateTimeOffset.UtcNow.AddHours(MetadataUpdateInHours).ToUnixTimeSeconds();
List<EntityUpdate> allUpdates = new List<EntityUpdate>();
Expand Down Expand Up @@ -141,7 +141,7 @@ private async Task<List<BaseItem>> GetItemsUpdated(CancellationToken cancellatio

string providerId = MetadataProvider.Tvdb.ToString();

List<BaseItem> toUpdateItems = new List<BaseItem>();
HashSet<BaseItem> toUpdateItems = new HashSet<BaseItem>();

Dictionary<string, string> providerIdPair = new Dictionary<string, string>() { { providerId, string.Empty } };
InternalItemsQuery query = new InternalItemsQuery();
Expand All @@ -151,10 +151,7 @@ private async Task<List<BaseItem>> GetItemsUpdated(CancellationToken cancellatio
providerIdPair[providerId] = update.RecordId!.Value.ToString(CultureInfo.InvariantCulture);
query.HasAnyProviderId = providerIdPair;
List<BaseItem> itemList = _libraryManager.GetItemList(query);
if (itemList.Count > 0 && !toUpdateItems.Contains(itemList[0]))
{
toUpdateItems.Add(itemList[0]);
}
toUpdateItems.UnionWith(itemList);
}

return toUpdateItems;
Expand Down

0 comments on commit 35fe6fa

Please sign in to comment.