diff --git a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs index 341536f5bf..fee706f7b1 100644 --- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs +++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs @@ -29,6 +29,8 @@ public interface ITrackedDownloadService public class TrackedDownloadService : ITrackedDownloadService, IHandle, + IHandle, + IHandle, IHandle { private readonly IParsingService _parsingService; @@ -272,6 +274,38 @@ public void Handle(MovieAddedEvent message) } } + public void Handle(MovieEditedEvent message) + { + var cachedItems = _cache.Values + .Where(t => + t.RemoteMovie?.Movie != null && + (t.RemoteMovie.Movie.Id == message.Movie?.Id || t.RemoteMovie.Movie.TmdbId == message.Movie?.TmdbId)) + .ToList(); + + if (cachedItems.Any()) + { + cachedItems.ForEach(UpdateCachedItem); + + _eventAggregator.PublishEvent(new TrackedDownloadRefreshedEvent(GetTrackedDownloads())); + } + } + + public void Handle(MoviesBulkEditedEvent message) + { + var cachedItems = _cache.Values + .Where(t => + t.RemoteMovie?.Movie != null && + message.Movies.Any(m => m.Id == t.RemoteMovie.Movie.Id || m.TmdbId == t.RemoteMovie.Movie.TmdbId)) + .ToList(); + + if (cachedItems.Any()) + { + cachedItems.ForEach(UpdateCachedItem); + + _eventAggregator.PublishEvent(new TrackedDownloadRefreshedEvent(GetTrackedDownloads())); + } + } + public void Handle(MoviesDeletedEvent message) { var cachedItems = _cache.Values