1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-21 22:05:43 -04:00

Fixed: EZTV logging generic error when there were no results

This commit is contained in:
Mark McDowall
2014-12-03 17:22:14 -08:00
parent 0cc4639e65
commit 29ee0ef2be
6 changed files with 48 additions and 29 deletions
@@ -1,7 +1,10 @@
using System;
using System.IO;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Indexers.Exceptions;
namespace NzbDrone.Core.Indexers
{
@@ -14,6 +17,22 @@ namespace NzbDrone.Core.Indexers
UseEnclosureUrl = true;
}
protected override bool PreProcess(IndexerResponse indexerResponse)
{
using (var xmlTextReader = XmlReader.Create(new StringReader(indexerResponse.Content), new XmlReaderSettings { DtdProcessing = DtdProcessing.Ignore, IgnoreComments = true }))
{
var document = XDocument.Load(xmlTextReader);
var items = GetItems(document).ToList();
if (items.Count == 1 && GetTitle(items.First()).Equals("No items exist - Try again later"))
{
throw new IndexerException(indexerResponse, "No results were found");
}
}
return base.PreProcess(indexerResponse);
}
protected override Int64 GetSize(XElement item)
{
var contentLength = item.FindDecendants("contentLength").SingleOrDefault();