Fix metadata saver check

This commit is contained in:
Shadowghost 2024-06-05 00:53:09 +02:00
parent 4714b3af67
commit 262f7dd98f
3 changed files with 19 additions and 3 deletions

View File

@ -140,6 +140,14 @@ namespace MediaBrowser.Controller.Providers
IEnumerable<IMetadataProvider<T>> GetMetadataProviders<T>(BaseItem item, LibraryOptions libraryOptions)
where T : BaseItem;
/// <summary>
/// Gets the metadata savers for the provided item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="libraryOptions">The library options.</param>
/// <returns>The metadata providers.</returns>
IEnumerable<IMetadataSaver> GetMetadataSavers(BaseItem item, LibraryOptions libraryOptions);
/// <summary>
/// Gets all metadata plugins.
/// </summary>

View File

@ -154,7 +154,8 @@ namespace MediaBrowser.Providers.Manager
id.IsAutomated = refreshOptions.IsAutomated;
var result = await RefreshWithProviders(metadataResult, id, refreshOptions, providers, ImageProvider, cancellationToken).ConfigureAwait(false);
var hasMetadataSavers = ProviderManager.GetMetadataSavers(item, libraryOptions).Any();
var result = await RefreshWithProviders(metadataResult, id, refreshOptions, providers, ImageProvider, hasMetadataSavers, cancellationToken).ConfigureAwait(false);
updateType |= result.UpdateType;
if (result.Failures > 0)
@ -639,6 +640,7 @@ namespace MediaBrowser.Providers.Manager
MetadataRefreshOptions options,
ICollection<IMetadataProvider> providers,
ItemImageProvider imageService,
bool isSavingMetadata,
CancellationToken cancellationToken)
{
var refreshResult = new RefreshResult
@ -670,8 +672,8 @@ namespace MediaBrowser.Providers.Manager
var foundImageTypes = new List<ImageType>();
// Do not execute local providers if we are identifying or replacing with NFO saving enabled
if (options.SearchResult is null && !(item.IsSaveLocalMetadataEnabled() && options.ReplaceAllMetadata))
// Do not execute local providers if we are identifying or replacing with local metadata saving enabled
if (options.SearchResult is null && !(isSavingMetadata && options.ReplaceAllMetadata))
{
foreach (var provider in providers.OfType<ILocalMetadataProvider<TItemType>>())
{

View File

@ -418,6 +418,12 @@ namespace MediaBrowser.Providers.Manager
return GetMetadataProvidersInternal<T>(item, libraryOptions, globalMetadataOptions, false, false);
}
/// <inheritdoc />
public IEnumerable<IMetadataSaver> GetMetadataSavers(BaseItem item, LibraryOptions libraryOptions)
{
return _savers.Where(i => IsSaverEnabledForItem(i, item, libraryOptions, ItemUpdateType.MetadataEdit, false));
}
private IEnumerable<IMetadataProvider<T>> GetMetadataProvidersInternal<T>(BaseItem item, LibraryOptions libraryOptions, MetadataOptions globalMetadataOptions, bool includeDisabled, bool forceEnableInternetMetadata)
where T : BaseItem
{