1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Tweaked Newznab/Torznab handling of attr without value.

This commit is contained in:
Taloth Saldono 2017-06-19 23:21:28 +02:00
parent 23552c3267
commit 475c99d492
2 changed files with 14 additions and 8 deletions

View File

@ -139,11 +139,14 @@ protected virtual int GetTvRageId(XElement item)
protected string TryGetNewznabAttribute(XElement item, string key, string defaultValue = "")
{
var attr = item.Elements(ns + "attr").FirstOrDefault(e => e.Attribute("name").Value.Equals(key, StringComparison.CurrentCultureIgnoreCase));
if (attr != null)
var attrElement = item.Elements(ns + "attr").FirstOrDefault(e => e.Attribute("name").Value.Equals(key, StringComparison.OrdinalIgnoreCase));
if (attrElement != null)
{
return attr.Attribute("value").Value;
var attrValue = attrElement.Attribute("value");
if (attrValue != null)
{
return attrValue.Value;
}
}
return defaultValue;

View File

@ -181,11 +181,14 @@ protected override string GetMagnetUrl(XElement item)
protected string TryGetTorznabAttribute(XElement item, string key, string defaultValue = "")
{
var attr = item.Elements(ns + "attr").FirstOrDefault(e => e.Attribute("name").Value.Equals(key, StringComparison.CurrentCultureIgnoreCase));
if (attr != null)
var attrElement = item.Elements(ns + "attr").FirstOrDefault(e => e.Attribute("name").Value.Equals(key, StringComparison.OrdinalIgnoreCase));
if (attrElement != null)
{
return attr.Attribute("value").Value;
var attrValue = attrElement.Attribute("value");
if (attrValue != null)
{
return attrValue.Value;
}
}
return defaultValue;