Fix missing season Index (#11472)

This commit is contained in:
gnattu 2024-05-05 22:21:00 +08:00 committed by GitHub
parent e2a22cec0e
commit 77a101cc98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View File

@ -72,7 +72,7 @@ namespace MediaBrowser.Providers.Manager
}
}
public async Task<ItemUpdateType> RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
public virtual async Task<ItemUpdateType> RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
{
var itemOfType = (TItemType)item;

View File

@ -8,6 +8,7 @@ using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
@ -35,6 +36,25 @@ namespace MediaBrowser.Providers.TV
_localizationManager = localizationManager;
}
public override async Task<ItemUpdateType> RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
{
if (item is Series series)
{
var seasons = series.GetRecursiveChildren(i => i is Season).ToList();
foreach (var season in seasons)
{
var hasUpdate = refreshOptions != null && season.BeforeMetadataRefresh(refreshOptions.ReplaceAllMetadata);
if (hasUpdate)
{
await season.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
}
}
}
return await base.RefreshMetadata(item, refreshOptions, cancellationToken).ConfigureAwait(false);
}
/// <inheritdoc />
protected override async Task AfterMetadataRefresh(Series item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
{