mirror of
https://github.com/Lidarr/Lidarr
synced 2026-05-08 20:59:57 +02:00
Tweaked Newznab/Torznab handling of attr without value.
This commit is contained in:
parent
23552c3267
commit
475c99d492
2 changed files with 14 additions and 8 deletions
|
|
@ -139,11 +139,14 @@ protected virtual int GetTvRageId(XElement item)
|
||||||
|
|
||||||
protected string TryGetNewznabAttribute(XElement item, string key, string defaultValue = "")
|
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));
|
var attrElement = item.Elements(ns + "attr").FirstOrDefault(e => e.Attribute("name").Value.Equals(key, StringComparison.OrdinalIgnoreCase));
|
||||||
|
if (attrElement != null)
|
||||||
if (attr != null)
|
|
||||||
{
|
{
|
||||||
return attr.Attribute("value").Value;
|
var attrValue = attrElement.Attribute("value");
|
||||||
|
if (attrValue != null)
|
||||||
|
{
|
||||||
|
return attrValue.Value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
|
|
||||||
|
|
@ -181,11 +181,14 @@ protected override string GetMagnetUrl(XElement item)
|
||||||
|
|
||||||
protected string TryGetTorznabAttribute(XElement item, string key, string defaultValue = "")
|
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));
|
var attrElement = item.Elements(ns + "attr").FirstOrDefault(e => e.Attribute("name").Value.Equals(key, StringComparison.OrdinalIgnoreCase));
|
||||||
|
if (attrElement != null)
|
||||||
if (attr != null)
|
|
||||||
{
|
{
|
||||||
return attr.Attribute("value").Value;
|
var attrValue = attrElement.Attribute("value");
|
||||||
|
if (attrValue != null)
|
||||||
|
{
|
||||||
|
return attrValue.Value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue