mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-08 10:44:23 -04:00
update season creator
This commit is contained in:
parent
1cb7a1b49c
commit
7a77aa42c5
@ -66,29 +66,39 @@ namespace MediaBrowser.Providers.TV
|
|||||||
.Distinct()
|
.Distinct()
|
||||||
.ToList())
|
.ToList())
|
||||||
{
|
{
|
||||||
var hasSeason = series.Children.OfType<Season>()
|
var existingSeason = series.Children.OfType<Season>()
|
||||||
.Any(i => i.IndexNumber.HasValue && i.IndexNumber.Value == seasonNumber);
|
.FirstOrDefault(i => i.IndexNumber.HasValue && i.IndexNumber.Value == seasonNumber);
|
||||||
|
|
||||||
if (!hasSeason)
|
if (existingSeason == null)
|
||||||
{
|
{
|
||||||
await AddSeason(series, seasonNumber, false, cancellationToken).ConfigureAwait(false);
|
await AddSeason(series, seasonNumber, false, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
}
|
}
|
||||||
|
else if (existingSeason.IsVirtualItem)
|
||||||
|
{
|
||||||
|
existingSeason.IsVirtualItem = false;
|
||||||
|
await existingSeason.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unknown season - create a dummy season to put these under
|
// Unknown season - create a dummy season to put these under
|
||||||
if (episodesInSeriesFolder.Any(i => !i.ParentIndexNumber.HasValue))
|
if (episodesInSeriesFolder.Any(i => !i.ParentIndexNumber.HasValue))
|
||||||
{
|
{
|
||||||
var hasSeason = series.Children.OfType<Season>()
|
var existingSeason = series.Children.OfType<Season>()
|
||||||
.Any(i => !i.IndexNumber.HasValue);
|
.FirstOrDefault(i => !i.IndexNumber.HasValue);
|
||||||
|
|
||||||
if (!hasSeason)
|
if (existingSeason == null)
|
||||||
{
|
{
|
||||||
await AddSeason(series, null, false, cancellationToken).ConfigureAwait(false);
|
await AddSeason(series, null, false, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
}
|
}
|
||||||
|
else if (existingSeason.IsVirtualItem)
|
||||||
|
{
|
||||||
|
existingSeason.IsVirtualItem = false;
|
||||||
|
await existingSeason.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasChanges;
|
return hasChanges;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user