The Free Software Media System - Server Backend & API
Merge pull request #17044 from Shadowghost/version-model-and-handling
Cody Robibero6e728b009f0c
diff --cc MediaBrowser.Providers/TV/SeriesMetadataService.csindex 02040653d1,70e75be11b..b350f482c3--- a/MediaBrowser.Providers/TV/SeriesMetadataService.cs+++ b/MediaBrowser.Providers/TV/SeriesMetadataService.cs@@@ -235,8 -297,29 +297,30 @@@ public class SeriesMetadataService : Meprivate async Task CreateSeasonsAsync(Series series, CancellationToken cancellationToken){var seriesChildren = series.GetRecursiveChildren(i => i is Episode || i is Season);++ // CreateSeasonsAsync can run before the episodes themselves have been refreshed during an+ // initial scan, so their ParentIndexNumber may still be unset. Resolve the season number+ // from the path first to avoid creating a premature "Season Unknown" instead of the real+ // season for episodes that live directly in a flat series folder.+ foreach (var episode in seriesChildren.OfType<Episode>())+ {+ if (episode.ParentIndexNumber.HasValue)+ {+ continue;+ }++ try+ {+ LibraryManager.FillMissingEpisodeNumbersFromPath(episode, false);+ }+ catch (Exception ex)+ {+ Logger.LogError(ex, "Error resolving season number from path for {Path}", episode.Path);+ }+ }+var seasons = seriesChildren.OfType<Season>().ToList();+ var episodes = seriesChildren.OfType<Episode>().ToList();var physicalSeasonIds = seasons.Where(e => e.LocationType != LocationType.Virtual)