private List<EpisodeParseResult> Fetch(IEnumerable<string> urls) { var result = new List<EpisodeParseResult>(); if (!IsConfigured) { _logger.Warn("Indexer '{0}' isn't configured correctly. please reconfigure the indexer in settings page.", Name); return result; } foreach (var url in urls) { try { _logger.Trace("Downloading RSS " + url); var reader = new SyndicationFeedXmlReader(_httpProvider.DownloadStream(url, Credentials)); var feed = SyndicationFeed.Load(reader).Items; foreach (var item in feed) { try { var parsedEpisode = ParseFeed(item); if (parsedEpisode != null) { parsedEpisode.NzbUrl = NzbDownloadUrl(item); parsedEpisode.NzbInfoUrl = NzbInfoUrl(item); parsedEpisode.Indexer = String.IsNullOrWhiteSpace(parsedEpisode.Indexer) ? Name : parsedEpisode.Indexer; result.Add(parsedEpisode); } } catch (Exception itemEx) { itemEx.Data.Add("FeedUrl", url); itemEx.Data.Add("Item", item.Title); _logger.ErrorException("An error occurred while processing feed item", itemEx); } } } catch (WebException webException) { if (webException.Message.Contains("503")) { _logger.Warn("{0} server is currently unavailable.{1} {2}", Name,url, webException.Message); } else { webException.Data.Add("FeedUrl", url); _logger.ErrorException("An error occurred while processing feed. " + url, webException); } } catch (Exception feedEx) { feedEx.Data.Add("FeedUrl", url); _logger.ErrorException("An error occurred while processing feed. " + url, feedEx); } } return result; }
protected virtual List <EpisodeParseResult> Fetch(IEnumerable <string> urls) { var result = new List <EpisodeParseResult>(); if (!IsConfigured) { _logger.Warn("Indexer '{0}' isn't configured correctly. please reconfigure the indexer in settings page.", Name); return(result); } foreach (var url in urls) { try { _logger.Trace("Downloading RSS " + url); var reader = new SyndicationFeedXmlReader(_httpProvider.DownloadStream(url, Credentials)); var feed = SyndicationFeed.Load(reader).Items; foreach (var item in feed) { try { var parsedEpisode = ParseFeed(item); if (parsedEpisode != null) { parsedEpisode.NzbUrl = NzbDownloadUrl(item); parsedEpisode.NzbInfoUrl = NzbInfoUrl(item); parsedEpisode.Indexer = String.IsNullOrWhiteSpace(parsedEpisode.Indexer) ? Name : parsedEpisode.Indexer; result.Add(parsedEpisode); } } catch (Exception itemEx) { itemEx.Data.Add("FeedUrl", url); itemEx.Data.Add("Item", item.Title); _logger.ErrorException("An error occurred while processing feed item", itemEx); } } } catch (WebException webException) { if (webException.Message.Contains("503")) { _logger.Warn("{0} server is currently unavailable.{1} {2}", Name, url, webException.Message); } else { webException.Data.Add("FeedUrl", url); _logger.ErrorException("An error occurred while processing feed. " + url, webException); } } catch (Exception feedEx) { feedEx.Data.Add("FeedUrl", url); _logger.ErrorException("An error occurred while processing feed. " + url, feedEx); } } return(result); }