Fix Headphones Download Auth, Add Special Parsing (#152)

* Add Secondary Backup Parsing Method if Regex Fails

* Add BasicAuth info to release for nzb download handling
This commit is contained in:
Qstick
2017-12-17 18:34:58 -05:00
committed by GitHub
parent ba3d6362af
commit ded7574227
11 changed files with 147 additions and 7 deletions
@@ -32,7 +32,10 @@ namespace NzbDrone.Core.Indexers.Headphones
public override IParseIndexerResponse GetParser()
{
return new NewznabRssParser();
return new HeadphonesRssParser
{
Settings = Settings
};
}
public Headphones(IHeadphonesCapabilitiesProvider capabilitiesProvider, IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
@@ -0,0 +1,23 @@
using System;
using System.Text;
using NzbDrone.Core.Indexers.Newznab;
namespace NzbDrone.Core.Indexers.Headphones
{
public class HeadphonesRssParser : NewznabRssParser
{
public const string ns = "{http://www.newznab.com/DTD/2010/feeds/attributes/}";
public HeadphonesSettings Settings { get; set; }
public HeadphonesRssParser()
{
PreferredEnclosureMimeTypes = UsenetEnclosureMimeTypes;
UseEnclosureUrl = true;
}
protected override string GetBasicAuth()
{
return Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes($"{Settings.Username}:{Settings.Password}")); ;
}
}
}
+6
View File
@@ -156,6 +156,7 @@ namespace NzbDrone.Core.Indexers
releaseInfo.Title = GetTitle(item);
releaseInfo.PublishDate = GetPublishDate(item);
releaseInfo.DownloadUrl = GetDownloadUrl(item);
releaseInfo.BasicAuthString = GetBasicAuth();
releaseInfo.InfoUrl = GetInfoUrl(item);
releaseInfo.CommentUrl = GetCommentUrl(item);
@@ -198,6 +199,11 @@ namespace NzbDrone.Core.Indexers
return XElementExtensions.ParseDate(dateString);
}
protected virtual string GetBasicAuth()
{
return null;
}
protected virtual string GetDownloadUrl(XElement item)
{
if (UseEnclosureUrl)