mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-26 22:46:37 -04:00
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:
@@ -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}")); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user