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:
parent
23552c3267
commit
475c99d492
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user