The Free Software Media System - Server Backend & API
Revert RefreshMetadata changes
Shadowghost98b561d62cc9
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.csindex ffb5fa14b7..b88572a67f 100644--- a/MediaBrowser.Controller/Entities/Folder.cs+++ b/MediaBrowser.Controller/Entities/Folder.cs@@ -459,11 +459,11 @@ namespace MediaBrowser.Controller.Entities// If it's an AggregateFolder, don't removeif (shouldRemove && itemsRemoved.Count > 0){- // Build a set of paths that are alternate versions or additional parts of valid children+ // Build a set of paths that are alternate versions of valid children// These items should not be deleted - they're managed by their primary video- var protectedPaths = validChildren+ var alternateVersionPaths = validChildren.OfType<Video>()- .SelectMany(v => (v.LocalAlternateVersions ?? []).Concat(v.AdditionalParts ?? []))+ .SelectMany(v => v.LocalAlternateVersions ?? []).Where(p => !string.IsNullOrEmpty(p)).ToHashSet(StringComparer.OrdinalIgnoreCase);@@ -485,10 +485,10 @@ namespace MediaBrowser.Controller.Entitiescontinue;}- // Check if path is in LocalAlternateVersions or AdditionalParts of any valid child- if (!string.IsNullOrEmpty(item.Path) && protectedPaths.Contains(item.Path))+ // Check if path is in LocalAlternateVersions of any valid child+ if (!string.IsNullOrEmpty(item.Path) && alternateVersionPaths.Contains(item.Path)){- Logger.LogDebug("Item path is a protected path (alternate version or additional part), skipping deletion: {Path}", item.Path);+ Logger.LogDebug("Item path matches an alternate version, skipping deletion: {Path}", item.Path);continue;}}@@ -569,7 +569,7 @@ namespace MediaBrowser.Controller.Entitiesif (container is not null){- await container.RefreshAllMetadata(refreshOptions, progress, cancellationToken).ConfigureAwait(false);+ await RefreshAllMetadataForContainer(container, refreshOptions, innerProgress, cancellationToken).ConfigureAwait(false);}else{@@ -593,11 +593,21 @@ namespace MediaBrowser.Controller.EntitiescancellationToken).ConfigureAwait(false);}+ private async Task RefreshAllMetadataForContainer(IMetadataContainer container, MetadataRefreshOptions refreshOptions, IProgress<double> progress, CancellationToken cancellationToken)+ {+ if (container is Series series)+ {+ await series.RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);+ }++ await container.RefreshAllMetadata(refreshOptions, progress, cancellationToken).ConfigureAwait(false);+ }+private async Task RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, bool recursive, IProgress<double> progress, CancellationToken cancellationToken){if (child is IMetadataContainer container){- await container.RefreshAllMetadata(refreshOptions, progress, cancellationToken).ConfigureAwait(false);+ await RefreshAllMetadataForContainer(container, refreshOptions, progress, cancellationToken).ConfigureAwait(false);}else{