From 1cdf0f5cc4c899ecb9e43d0a22c907f3395c00da Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Thu, 16 May 2024 08:22:40 +0200 Subject: [PATCH] Apply review suggestion --- MediaBrowser.Controller/Entities/TV/Series.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index dbc323db57..a2d5e3867e 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -214,15 +214,19 @@ namespace MediaBrowser.Controller.Entities.TV public Dictionary GetSeasonNames() { - if (_seasonNames.Count > 0) + if (_seasonNames.Count == 0) { - return _seasonNames; + var childSeasons = Children.OfType() + .Where(s => s.IndexNumber.HasValue) + .DistinctBy(s => s.IndexNumber); + + foreach (var season in childSeasons) + { + _seasonNames[season.IndexNumber.Value] = season.Name; + } } - return Children.OfType() - .Where(s => s.IndexNumber.HasValue) - .DistinctBy(s => s.IndexNumber) - .ToDictionary(s => s.IndexNumber.Value, s => s.Name); + return _seasonNames; } public void SetSeasonName(int index, string name)