Fixed: (Filelist) Unable to add

Fixes #109
pull/67/head
Qstick 4 years ago
parent b3fb640969
commit ee6ae386ca

@ -24,12 +24,12 @@ namespace NzbDrone.Core.Indexers.FileList
public override IIndexerRequestGenerator GetRequestGenerator() public override IIndexerRequestGenerator GetRequestGenerator()
{ {
return new FileListRequestGenerator() { Settings = Settings, BaseUrl = BaseUrl }; return new FileListRequestGenerator() { Settings = Settings, BaseUrl = BaseUrl, Capabilities = Capabilities };
} }
public override IParseIndexerResponse GetParser() public override IParseIndexerResponse GetParser()
{ {
return new FileListParser(Settings, BaseUrl); return new FileListParser(Settings, BaseUrl, Capabilities.Categories);
} }
private IndexerCapabilities SetCapabilities() private IndexerCapabilities SetCapabilities()

@ -22,5 +22,6 @@ namespace NzbDrone.Core.Indexers.FileList
public bool DoubleUp { get; set; } public bool DoubleUp { get; set; }
[JsonProperty(PropertyName = "upload_date")] [JsonProperty(PropertyName = "upload_date")]
public DateTime UploadDate { get; set; } public DateTime UploadDate { get; set; }
public string Category { get; set; }
} }
} }

@ -12,11 +12,13 @@ namespace NzbDrone.Core.Indexers.FileList
{ {
private readonly string _baseUrl; private readonly string _baseUrl;
private readonly FileListSettings _settings; private readonly FileListSettings _settings;
private readonly IndexerCapabilitiesCategories _categories;
public FileListParser(FileListSettings settings, string baseUrl) public FileListParser(FileListSettings settings, string baseUrl, IndexerCapabilitiesCategories categories)
{ {
_settings = settings; _settings = settings;
_baseUrl = baseUrl; _baseUrl = baseUrl;
_categories = categories;
} }
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse) public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
@ -57,6 +59,7 @@ namespace NzbDrone.Core.Indexers.FileList
Guid = string.Format("FileList-{0}", id), Guid = string.Format("FileList-{0}", id),
Title = result.Name, Title = result.Name,
Size = result.Size, Size = result.Size,
Category = _categories.MapTrackerCatDescToNewznab(result.Category),
DownloadUrl = GetDownloadUrl(id), DownloadUrl = GetDownloadUrl(id),
InfoUrl = GetInfoUrl(id), InfoUrl = GetInfoUrl(id),
Seeders = result.Seeders, Seeders = result.Seeders,

@ -11,6 +11,7 @@ namespace NzbDrone.Core.Indexers.FileList
{ {
public string BaseUrl { get; set; } public string BaseUrl { get; set; }
public FileListSettings Settings { get; set; } public FileListSettings Settings { get; set; }
public IndexerCapabilities Capabilities { get; set; }
public Func<IDictionary<string, string>> GetCookies { get; set; } public Func<IDictionary<string, string>> GetCookies { get; set; }
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; } public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
@ -106,7 +107,7 @@ namespace NzbDrone.Core.Indexers.FileList
private IEnumerable<IndexerRequest> GetRequest(string searchType, int[] categories, string parameters) private IEnumerable<IndexerRequest> GetRequest(string searchType, int[] categories, string parameters)
{ {
var categoriesQuery = string.Join(",", categories.Distinct()); var categoriesQuery = string.Join(",", Capabilities.Categories.MapTorznabCapsToTrackers(categories));
var baseUrl = string.Format("{0}/api.php?action={1}&category={2}&username={3}&passkey={4}{5}", BaseUrl.TrimEnd('/'), searchType, categoriesQuery, Settings.Username.Trim(), Settings.Passkey.Trim(), parameters); var baseUrl = string.Format("{0}/api.php?action={1}&category={2}&username={3}&passkey={4}{5}", BaseUrl.TrimEnd('/'), searchType, categoriesQuery, Settings.Username.Trim(), Settings.Passkey.Trim(), parameters);

Loading…
Cancel
Save