|
|
|
@ -204,7 +204,9 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
|
var seasonNames = series.SeasonNames;
|
|
|
|
|
var seriesChildren = series.GetRecursiveChildren(i => i is Episode || i is Season);
|
|
|
|
|
var seasons = seriesChildren.OfType<Season>().ToList();
|
|
|
|
|
foreach (var season in seasons.Where(season => season.IndexNumber is null).Where(season => season.Name.Contains("season", StringComparison.InvariantCultureIgnoreCase)))
|
|
|
|
|
|
|
|
|
|
// Very old Jellyfin library will have a cursed DB that a season may have NULL index number
|
|
|
|
|
foreach (var season in seasons.Where(season => season.IndexNumber is null).Where(season => season.Name.Any(char.IsDigit)))
|
|
|
|
|
{
|
|
|
|
|
season.IndexNumber = int.Parse(new string(season.Name.Where(char.IsDigit).ToArray()), NumberStyles.Integer, CultureInfo.InvariantCulture);
|
|
|
|
|
await season.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
|
|
|
|
|