Don't force non-virtual when all episodes in season have isMissing flag.

This commit is contained in:
LJQ 2024-08-11 18:06:09 +08:00
parent 3f3145600c
commit 6709c80f0a

View File

@ -210,12 +210,16 @@ namespace MediaBrowser.Providers.TV
await CreateSeasonAsync(series, seasonName, seasonNumber, cancellationToken).ConfigureAwait(false); await CreateSeasonAsync(series, seasonName, seasonNumber, cancellationToken).ConfigureAwait(false);
} }
else if (existingSeason.IsVirtualItem) else if (existingSeason.IsVirtualItem)
{
var episodeCount = seriesChildren.OfType<Episode>().Count(e => e.ParentIndexNumber == seasonNumber && !e.IsMissingEpisode);
if (episodeCount > 0)
{ {
existingSeason.IsVirtualItem = false; existingSeason.IsVirtualItem = false;
await existingSeason.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false); await existingSeason.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
} }
} }
} }
}
/// <summary> /// <summary>
/// Creates a new season, adds it to the database by linking it to the [series] and refreshes the metadata. /// Creates a new season, adds it to the database by linking it to the [series] and refreshes the metadata.