update missing season creator

This commit is contained in:
Luke Pulverenti 2016-05-20 15:45:04 -04:00
parent da91a37f71
commit 2daf91b3fe
6 changed files with 9 additions and 36 deletions

View File

@ -23,19 +23,6 @@ namespace MediaBrowser.Controller.Entities
PhysicalLocationsList = new List<string>(); PhysicalLocationsList = new List<string>();
} }
/// <summary>
/// Gets a value indicating whether this instance is virtual folder.
/// </summary>
/// <value><c>true</c> if this instance is virtual folder; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public override bool IsVirtualFolder
{
get
{
return true;
}
}
[IgnoreDataMember] [IgnoreDataMember]
protected override bool SupportsShortcutChildren protected override bool SupportsShortcutChildren
{ {

View File

@ -126,19 +126,6 @@ namespace MediaBrowser.Controller.Entities
/// <value><c>true</c> if this instance is root; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance is root; otherwise, <c>false</c>.</value>
public bool IsRoot { get; set; } public bool IsRoot { get; set; }
/// <summary>
/// Gets a value indicating whether this instance is virtual folder.
/// </summary>
/// <value><c>true</c> if this instance is virtual folder; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public virtual bool IsVirtualFolder
{
get
{
return false;
}
}
public virtual List<LinkedChild> LinkedChildren { get; set; } public virtual List<LinkedChild> LinkedChildren { get; set; }
[IgnoreDataMember] [IgnoreDataMember]

View File

@ -69,7 +69,7 @@ namespace MediaBrowser.Providers.TV
if (!hasSeason) if (!hasSeason)
{ {
await AddSeason(series, seasonNumber, cancellationToken).ConfigureAwait(false); await AddSeason(series, seasonNumber, false, cancellationToken).ConfigureAwait(false);
hasChanges = true; hasChanges = true;
} }
@ -83,7 +83,7 @@ namespace MediaBrowser.Providers.TV
if (!hasSeason) if (!hasSeason)
{ {
await AddSeason(series, null, cancellationToken).ConfigureAwait(false); await AddSeason(series, null, false, cancellationToken).ConfigureAwait(false);
hasChanges = true; hasChanges = true;
} }
@ -95,12 +95,9 @@ namespace MediaBrowser.Providers.TV
/// <summary> /// <summary>
/// Adds the season. /// Adds the season.
/// </summary> /// </summary>
/// <param name="series">The series.</param>
/// <param name="seasonNumber">The season number.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{Season}.</returns>
public async Task<Season> AddSeason(Series series, public async Task<Season> AddSeason(Series series,
int? seasonNumber, int? seasonNumber,
bool isMissingSeason,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
var seasonName = seasonNumber == 0 ? var seasonName = seasonNumber == 0 ?
@ -113,7 +110,8 @@ namespace MediaBrowser.Providers.TV
{ {
Name = seasonName, Name = seasonName,
IndexNumber = seasonNumber, IndexNumber = seasonNumber,
Id = _libraryManager.GetNewItemId((series.Id + (seasonNumber ?? -1).ToString(_usCulture) + seasonName), typeof(Season)) Id = _libraryManager.GetNewItemId((series.Id + (seasonNumber ?? -1).ToString(_usCulture) + seasonName), typeof(Season)),
IsMissingSeason = isMissingSeason
}; };
season.SetParent(series); season.SetParent(series);

View File

@ -418,7 +418,7 @@ namespace MediaBrowser.Providers.TV
if (season == null) if (season == null)
{ {
var provider = new DummySeasonProvider(_config, _logger, _localization, _libraryManager, _fileSystem); var provider = new DummySeasonProvider(_config, _logger, _localization, _libraryManager, _fileSystem);
season = await provider.AddSeason(series, seasonNumber, cancellationToken).ConfigureAwait(false); season = await provider.AddSeason(series, seasonNumber, true, cancellationToken).ConfigureAwait(false);
} }
var name = string.Format("Episode {0}", episodeNumber.ToString(_usCulture)); var name = string.Format("Episode {0}", episodeNumber.ToString(_usCulture));

View File

@ -69,7 +69,7 @@ namespace MediaBrowser.Providers.TV
private ItemUpdateType SaveIsMissing(Season item, List<Episode> episodes) private ItemUpdateType SaveIsMissing(Season item, List<Episode> episodes)
{ {
var isMissing = item.LocationType == LocationType.Virtual && episodes.All(i => i.IsMissingEpisode); var isMissing = item.LocationType == LocationType.Virtual && (episodes.Count == 0 || episodes.All(i => i.IsMissingEpisode));
if (item.IsMissingSeason != isMissing) if (item.IsMissingSeason != isMissing)
{ {

View File

@ -1420,8 +1420,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
MediaTypes = new[] { MediaType.Video }, MediaTypes = new[] { MediaType.Video },
Recursive = true, Recursive = true,
AncestorIds = folders.Select(i => i.Id.ToString("N")).ToArray(), AncestorIds = folders.Select(i => i.Id.ToString("N")).ToArray(),
IsFolder = false,
ExcludeLocationTypes = new[] { LocationType.Virtual }, ExcludeLocationTypes = new[] { LocationType.Virtual },
Limit = Math.Min(10, query.Limit ?? int.MaxValue), Limit = Math.Min(200, query.Limit ?? int.MaxValue),
SortBy = new[] { ItemSortBy.DateCreated }, SortBy = new[] { ItemSortBy.DateCreated },
SortOrder = SortOrder.Descending SortOrder = SortOrder.Descending
}); });