Fixed: Processing updated episodes in series after refresh

Closes #6560
This commit is contained in:
Mark McDowall 2024-02-27 16:56:59 -08:00 committed by Mark McDowall
parent fa600e62e0
commit 16d3827dbd
2 changed files with 9 additions and 6 deletions

View File

@ -55,6 +55,8 @@ namespace NzbDrone.Core.Tv
{ {
if (message.Series.AddOptions == null) if (message.Series.AddOptions == null)
{ {
var toSearch = new List<int>();
if (!message.Series.Monitored) if (!message.Series.Monitored)
{ {
_logger.Debug("Series is not monitored"); _logger.Debug("Series is not monitored");
@ -65,19 +67,22 @@ namespace NzbDrone.Core.Tv
a.AirDateUtc.HasValue && a.AirDateUtc.HasValue &&
a.AirDateUtc.Value.Between(DateTime.UtcNow.AddDays(-14), DateTime.UtcNow.AddDays(1)) && a.AirDateUtc.Value.Between(DateTime.UtcNow.AddDays(-14), DateTime.UtcNow.AddDays(1)) &&
a.Monitored) a.Monitored)
.Select(e => e.Id)
.ToList(); .ToList();
if (previouslyAired.Empty()) if (previouslyAired.Empty())
{ {
_logger.Debug("Newly added episodes all air in the future"); _logger.Debug("Newly added episodes all air in the future");
_searchCache.Set(message.Series.Id.ToString(), previouslyAired.Select(e => e.Id).ToList());
} }
toSearch.AddRange(previouslyAired);
var absoluteEpisodeNumberAdded = message.Updated.Where(a => var absoluteEpisodeNumberAdded = message.Updated.Where(a =>
a.AbsoluteEpisodeNumberAdded && a.AbsoluteEpisodeNumberAdded &&
a.AirDateUtc.HasValue && a.AirDateUtc.HasValue &&
a.AirDateUtc.Value.Between(DateTime.UtcNow.AddDays(-14), DateTime.UtcNow.AddDays(1)) && a.AirDateUtc.Value.Between(DateTime.UtcNow.AddDays(-14), DateTime.UtcNow.AddDays(1)) &&
a.Monitored) a.Monitored)
.Select(e => e.Id)
.ToList(); .ToList();
if (absoluteEpisodeNumberAdded.Empty()) if (absoluteEpisodeNumberAdded.Empty())
@ -85,10 +90,7 @@ namespace NzbDrone.Core.Tv
_logger.Debug("No updated episodes recently aired and had absolute episode number added"); _logger.Debug("No updated episodes recently aired and had absolute episode number added");
} }
var toSearch = new List<int>(); toSearch.AddRange(absoluteEpisodeNumberAdded);
toSearch.AddRange(previouslyAired.Select(e => e.Id));
toSearch.AddRange(absoluteEpisodeNumberAdded.Select(e => e.Id));
if (toSearch.Any()) if (toSearch.Any())
{ {

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using NzbDrone.Common.Messaging; using NzbDrone.Common.Messaging;
@ -15,6 +15,7 @@ namespace NzbDrone.Core.Tv.Events
{ {
Series = series; Series = series;
Added = new ReadOnlyCollection<Episode>(added); Added = new ReadOnlyCollection<Episode>(added);
Updated = new ReadOnlyCollection<Episode>(updated);
Removed = new ReadOnlyCollection<Episode>(removed); Removed = new ReadOnlyCollection<Episode>(removed);
} }
} }