예제 #1
0
        public override ValidationResult Test()
        {
            var releases = _feedFetcher.FetchRss(this);

            if (releases.Any())
            {
                return(new ValidationResult());
            }

            try
            {
                var url = RecentFeed.First();
                var xml = _httpProvider.DownloadString(url);

                NewznabPreProcessor.Process(xml, url);
            }
            catch (ApiKeyException)
            {
                _logger.Warn("Indexer returned result for Newznab RSS URL, API Key appears to be invalid");

                var apiKeyFailure = new ValidationFailure("ApiKey", "Invalid API Key");
                return(new ValidationResult(new List <ValidationFailure> {
                    apiKeyFailure
                }));
            }
            catch (RequestLimitReachedException)
            {
                _logger.Warn("Request limit reached");
            }
            catch (Exception ex)
            {
                _logger.WarnException("Unable to connect to indexer: " + ex.Message, ex);

                var failure = new ValidationFailure("Url", "Unable to connect to indexer, check the log for more details");
                return(new ValidationResult(new List <ValidationFailure> {
                    failure
                }));
            }

            return(new ValidationResult());
        }
예제 #2
0
 protected override void PreProcess(string source, string url)
 {
     NewznabPreProcessor.Process(source, url);
 }