mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
url is now logged when feed parse fails.
This commit is contained in:
parent
2f20aeaec5
commit
59eb4e68ec
@ -12,7 +12,7 @@ namespace NzbDrone.Core.Indexers
|
|||||||
{
|
{
|
||||||
public interface IParseFeed
|
public interface IParseFeed
|
||||||
{
|
{
|
||||||
IEnumerable<ReportInfo> Process(Stream source);
|
IEnumerable<ReportInfo> Process(Stream source, string url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BasicRssParser : IParseFeed
|
public class BasicRssParser : IParseFeed
|
||||||
@ -24,10 +24,10 @@ public BasicRssParser()
|
|||||||
_logger = LogManager.GetCurrentClassLogger();
|
_logger = LogManager.GetCurrentClassLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<ReportInfo> Process(Stream source)
|
public IEnumerable<ReportInfo> Process(Stream source, string url)
|
||||||
{
|
{
|
||||||
var xdoc = XDocument.Load(source);
|
var document = XDocument.Load(source);
|
||||||
var items = xdoc.Descendants("item");
|
var items = document.Descendants("item");
|
||||||
|
|
||||||
var result = new List<ReportInfo>();
|
var result = new List<ReportInfo>();
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ public IEnumerable<ReportInfo> Process(Stream source)
|
|||||||
catch (Exception itemEx)
|
catch (Exception itemEx)
|
||||||
{
|
{
|
||||||
itemEx.Data.Add("Item", item.Title());
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ public static long GetReportSize(string sizeString)
|
|||||||
private static long ConvertToBytes(double value, int power)
|
private static long ConvertToBytes(double value, int power)
|
||||||
{
|
{
|
||||||
var multiplier = Math.Pow(1024, power);
|
var multiplier = Math.Pow(1024, power);
|
||||||
var result = value*multiplier;
|
var result = value * multiplier;
|
||||||
|
|
||||||
return Convert.ToInt64(result);
|
return Convert.ToInt64(result);
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ private List<ReportInfo> Fetch(IIndexer indexer, IEnumerable<string> urls)
|
|||||||
{
|
{
|
||||||
_logger.Trace("Downloading Feed " + url);
|
_logger.Trace("Downloading Feed " + url);
|
||||||
var stream = _httpProvider.DownloadStream(url);
|
var stream = _httpProvider.DownloadStream(url);
|
||||||
result.AddRange(indexer.Parser.Process(stream));
|
result.AddRange(indexer.Parser.Process(stream, url));
|
||||||
}
|
}
|
||||||
catch (WebException webException)
|
catch (WebException webException)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user