From 59eb4e68ec30f82c550c32732ef0d23994926f6b Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Thu, 15 Aug 2013 22:38:30 -0700 Subject: [PATCH] url is now logged when feed parse fails. --- NzbDrone.Core/Indexers/BasicRssParser.cs | 16 ++++++++-------- NzbDrone.Core/Indexers/IndexerFetchService.cs | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/NzbDrone.Core/Indexers/BasicRssParser.cs b/NzbDrone.Core/Indexers/BasicRssParser.cs index 9badc1fcc..d29889248 100644 --- a/NzbDrone.Core/Indexers/BasicRssParser.cs +++ b/NzbDrone.Core/Indexers/BasicRssParser.cs @@ -12,7 +12,7 @@ namespace NzbDrone.Core.Indexers { public interface IParseFeed { - IEnumerable Process(Stream source); + IEnumerable Process(Stream source, string url); } public class BasicRssParser : IParseFeed @@ -24,10 +24,10 @@ namespace NzbDrone.Core.Indexers _logger = LogManager.GetCurrentClassLogger(); } - public IEnumerable Process(Stream source) + public IEnumerable Process(Stream source, string url) { - var xdoc = XDocument.Load(source); - var items = xdoc.Descendants("item"); + var document = XDocument.Load(source); + var items = document.Descendants("item"); var result = new List(); @@ -47,7 +47,7 @@ namespace NzbDrone.Core.Indexers catch (Exception itemEx) { itemEx.Data.Add("Item", item.Title()); - _logger.ErrorException("An error occurred while processing feed item", itemEx); + _logger.ErrorException("An error occurred while processing feed item from " + url, itemEx); } } @@ -155,8 +155,8 @@ namespace NzbDrone.Core.Indexers return ConvertToBytes(Convert.ToDouble(value), 2); } - if (unit.Equals("GB", StringComparison.InvariantCultureIgnoreCase) || - unit.Equals("GiB", StringComparison.InvariantCultureIgnoreCase)) + if (unit.Equals("GB", StringComparison.InvariantCultureIgnoreCase) || + unit.Equals("GiB", StringComparison.InvariantCultureIgnoreCase)) { return ConvertToBytes(Convert.ToDouble(value), 3); } @@ -167,7 +167,7 @@ namespace NzbDrone.Core.Indexers private static long ConvertToBytes(double value, int power) { var multiplier = Math.Pow(1024, power); - var result = value*multiplier; + var result = value * multiplier; return Convert.ToInt64(result); } diff --git a/NzbDrone.Core/Indexers/IndexerFetchService.cs b/NzbDrone.Core/Indexers/IndexerFetchService.cs index 79aac3e3e..097214eb6 100644 --- a/NzbDrone.Core/Indexers/IndexerFetchService.cs +++ b/NzbDrone.Core/Indexers/IndexerFetchService.cs @@ -100,7 +100,7 @@ namespace NzbDrone.Core.Indexers { _logger.Trace("Downloading Feed " + url); var stream = _httpProvider.DownloadStream(url); - result.AddRange(indexer.Parser.Process(stream)); + result.AddRange(indexer.Parser.Process(stream, url)); } catch (WebException webException) {