Esempio n. 1
0
        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);
                }
            }
        }
Esempio n. 2
0
 public void Handle(EpisodeDownloadedEvent message)
 {
     foreach (var episode in message.Episode.Episodes)
     {
         BroadcastResourceChange(ModelAction.Updated, episode.Id);
     }
 }
Esempio n. 3
0
        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.Warn(ex, "Unable to send OnDownload notification to: " + notification.Definition.Name);
                }
            }
        }
        public void Handle(EpisodeDownloadedEvent message)
        {
            var messageBody = GetMessage(message.Episode.Series, message.Episode.Episodes, message.Episode.ParsedEpisodeInfo.Quality);

            foreach (var notification in All().Where(n => n.OnDownload))
            {
                try
                {
                    notification.Instance.OnDownload(messageBody, message.Episode.Series);
                }

                catch (Exception ex)
                {
                    _logger.WarnException("Unable to send OnDownload notification to: " + notification.Name, ex);
                }
            }
        }
Esempio n. 5
0
        public void Handle(EpisodeDownloadedEvent message)
        {
            var messageBody = GetMessage(message.Episode.Series, message.Episode.Episodes, message.Episode.ParsedEpisodeInfo.Quality);

            foreach (var notification in _notificationFactory.OnDownloadEnabled())
            {
                try
                {
                    notification.OnDownload(messageBody, message.Episode.Series);
                }

                catch (Exception ex)
                {
                    _logger.WarnException("Unable to send OnDownload notification to: " + notification.Definition.Name, ex);
                }
            }
        }