|
|
@ -1,6 +1,7 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
using System.Xml;
|
|
|
|
using System.Xml.Linq;
|
|
|
|
using System.Xml.Linq;
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
using NzbDrone.Core.Indexers.Exceptions;
|
|
|
|
using NzbDrone.Core.Indexers.Exceptions;
|
|
|
@ -80,6 +81,20 @@ namespace NzbDrone.Core.Indexers.Newznab
|
|
|
|
|
|
|
|
|
|
|
|
protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInfo)
|
|
|
|
protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInfo)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!item.Elements("enclosure").Any(e =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var type = e.Attribute("type");
|
|
|
|
|
|
|
|
if (type == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return type.Value == "application/x-nzb";
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
releaseInfo = base.ProcessItem(item, releaseInfo);
|
|
|
|
releaseInfo = base.ProcessItem(item, releaseInfo);
|
|
|
|
releaseInfo.ImdbId = GetImdbId(item);
|
|
|
|
releaseInfo.ImdbId = GetImdbId(item);
|
|
|
|
releaseInfo.Grabs = GetGrabs(item);
|
|
|
|
releaseInfo.Grabs = GetGrabs(item);
|
|
|
@ -151,7 +166,29 @@ namespace NzbDrone.Core.Indexers.Newznab
|
|
|
|
|
|
|
|
|
|
|
|
if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
|
|
|
|
if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
url = ParseUrl((string)item.Element("enclosure").Attribute("url"));
|
|
|
|
var enclosure = item.Elements("enclosure");
|
|
|
|
|
|
|
|
var filtered = enclosure.Where(e =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var type = e.Attribute("type");
|
|
|
|
|
|
|
|
if (type == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return type.Value == "application/x-nzb";
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var xElements = filtered as XElement[] ?? filtered.ToArray();
|
|
|
|
|
|
|
|
if (!xElements.Any())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return url;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var attr = xElements.First().Attribute("url");
|
|
|
|
|
|
|
|
if (attr != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
url = attr.Value;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return url;
|
|
|
|
return url;
|
|
|
|