public void Handle(EpisodeDownloadedEvent message) { var downloadMessage = new DownloadMessage(); downloadMessage.Message = GetMessage(message.Episode.Series, message.Episode.Episodes, message.Episode.Quality); downloadMessage.Series = message.Episode.Series; downloadMessage.EpisodeFile = message.EpisodeFile; downloadMessage.OldFiles = message.OldFiles; foreach (var notification in _notificationFactory.OnDownloadEnabled()) { try { if (downloadMessage.OldFiles.Any() && !((NotificationDefinition)notification.Definition).OnUpgrade) { continue; } notification.OnDownload(downloadMessage); } catch (Exception ex) { _logger.WarnException("Unable to send OnDownload notification to: " + notification.Definition.Name, ex); } } }
public void Handle(MovieDownloadedEvent message) { var downloadMessage = new DownloadMessage(); downloadMessage.Message = GetMessage(message.Movie.Movie, message.Movie.Quality); downloadMessage.MovieFile = message.MovieFile; downloadMessage.Movie = message.Movie.Movie; downloadMessage.OldMovieFiles = message.OldFiles; downloadMessage.SourcePath = message.Movie.Path; downloadMessage.DownloadId = message.DownloadId; foreach (var notification in _notificationFactory.OnDownloadEnabled()) { try { if (ShouldHandleMovie(notification.Definition, message.Movie.Movie)) { if (downloadMessage.OldMovieFiles.Empty() || ((NotificationDefinition)notification.Definition).OnUpgrade) { notification.OnDownload(downloadMessage); } } } catch (Exception ex) { _logger.Warn(ex, "Unable to send OnDownload notification to: " + notification.Definition.Name); } } }
public void Handle(EpisodeDownloadedEvent message) { var downloadMessage = new DownloadMessage(); downloadMessage.Message = GetMessage(message.Episode.Series, message.Episode.Episodes, message.Episode.Quality); downloadMessage.Series = message.Episode.Series; downloadMessage.EpisodeFile = message.EpisodeFile; downloadMessage.OldFiles = message.OldFiles; downloadMessage.SourcePath = message.Episode.Path; foreach (var notification in _notificationFactory.OnDownloadEnabled()) { try { if (ShouldHandleSeries(notification.Definition, message.Episode.Series)) { if (downloadMessage.OldFiles.Empty() || ((NotificationDefinition)notification.Definition).OnUpgrade) { notification.OnDownload(downloadMessage); } } } catch (Exception ex) { _logger.WarnException("Unable to send OnDownload notification to: " + notification.Definition.Name, ex); } } }
public void Handle(EpisodeImportedEvent message) { if (!message.NewDownload) { return; } var downloadMessage = new DownloadMessage { Message = GetMessage(message.EpisodeInfo.Series, message.EpisodeInfo.Episodes, message.EpisodeInfo.Quality), Series = message.EpisodeInfo.Series, EpisodeFile = message.ImportedEpisode, OldFiles = message.OldFiles, SourcePath = message.EpisodeInfo.Path, DownloadClient = message.DownloadClientInfo?.Name, DownloadId = message.DownloadId }; foreach (var notification in _notificationFactory.OnDownloadEnabled()) { try { if (ShouldHandleSeries(notification.Definition, message.EpisodeInfo.Series)) { if (downloadMessage.OldFiles.Empty() || ((NotificationDefinition)notification.Definition).OnUpgrade) { notification.OnDownload(downloadMessage); } } } catch (Exception ex) { _logger.Warn(ex, "Unable to send OnDownload notification to: " + notification.Definition.Name); } } }
public abstract void OnDownload(DownloadMessage message);
public virtual void OnDownload(DownloadMessage message) { }