fix MissingEpisodeProvider repeatedly adding and removing unaired items

This commit is contained in:
Luke Pulverenti 2017-08-23 12:45:04 -04:00
parent db4e0a38e9
commit 4f76955563

View File

@ -191,6 +191,8 @@ namespace MediaBrowser.Providers.TV
});
}
private const double UnairedEpisodeThresholdDays = 2;
/// <summary>
/// Adds the missing episodes.
/// </summary>
@ -248,8 +250,7 @@ namespace MediaBrowser.Providers.TV
var targetSeries = DetermineAppropriateSeries(series, tuple.Item1);
var unairedThresholdDays = 2;
now = now.AddDays(0 - unairedThresholdDays);
now = now.AddDays(0 - UnairedEpisodeThresholdDays);
if (airDate.Value < now)
{
@ -329,10 +330,14 @@ namespace MediaBrowser.Providers.TV
return true;
}
if (!allowMissingEpisodes && i.Episode.IsMissingEpisode && !i.Episode.IsUnaired)
if (!allowMissingEpisodes && i.Episode.IsMissingEpisode)
{
// If it's missing, but not unaired, remove it
if (!i.Episode.PremiereDate.HasValue || i.Episode.PremiereDate.Value.ToLocalTime().Date.AddDays(UnairedEpisodeThresholdDays) < DateTime.Now.Date)
{
return true;
}
}
return false;
}