diff --git a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs index 1c06d369c..ea02f1d39 100644 --- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs +++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs @@ -28,7 +28,8 @@ namespace NzbDrone.Core.Download.TrackedDownloads public class TrackedDownloadService : ITrackedDownloadService, IHandle, - IHandle + IHandle, + IHandle { private readonly IParsingService _parsingService; private readonly IHistoryService _historyService; @@ -281,16 +282,35 @@ namespace NzbDrone.Core.Download.TrackedDownloads public void Handle(SeriesDeletedEvent message) { var cachedItems = _cache.Values.Where(t => - t.RemoteEpisode?.Series != null && - message.Series.Any(s => s.Id == t.RemoteEpisode.Series.Id)) - .ToList(); + t.RemoteEpisode?.Series != null && + message.Series.Any(s => s.Id == t.RemoteEpisode.Series.Id)) + .ToList(); - if (cachedItems.Any()) + if (cachedItems.Empty()) { - cachedItems.ForEach(UpdateCachedItem); - - _eventAggregator.PublishEvent(new TrackedDownloadRefreshedEvent(GetTrackedDownloads())); + return; } + + cachedItems.ForEach(UpdateCachedItem); + + _eventAggregator.PublishEvent(new TrackedDownloadRefreshedEvent(GetTrackedDownloads())); + } + + public void Handle(SeriesEditedEvent message) + { + var cachedItems = _cache.Values.Where(t => + t.RemoteEpisode?.Series != null && + message.Series.Id == t.RemoteEpisode.Series.Id) + .ToList(); + + if (cachedItems.Empty()) + { + return; + } + + cachedItems.ForEach(UpdateCachedItem); + + _eventAggregator.PublishEvent(new TrackedDownloadRefreshedEvent(GetTrackedDownloads())); } } } diff --git a/src/NzbDrone.Core/Tv/SeriesService.cs b/src/NzbDrone.Core/Tv/SeriesService.cs index 6fd4551cf..ca6fb444c 100644 --- a/src/NzbDrone.Core/Tv/SeriesService.cs +++ b/src/NzbDrone.Core/Tv/SeriesService.cs @@ -238,6 +238,15 @@ namespace NzbDrone.Core.Tv _seriesRepository.UpdateMany(series); _logger.Debug("{0} series updated", series.Count); + var updatedSeries = GetSeries(series.Select(s => s.Id)); + + foreach (var s in updatedSeries) + { + var oldSeries = series.Single(c => c.Id == s.Id); + + _eventAggregator.PublishEvent(new SeriesEditedEvent(s, oldSeries)); + } + return series; }