mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-04-12 16:00:47 +02:00
parent
b3fb640969
commit
ee6ae386ca
4 changed files with 9 additions and 4 deletions
|
|
@ -24,12 +24,12 @@ public FileList(IHttpClient httpClient, IEventAggregator eventAggregator, IIndex
|
|||
|
||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||
{
|
||||
return new FileListRequestGenerator() { Settings = Settings, BaseUrl = BaseUrl };
|
||||
return new FileListRequestGenerator() { Settings = Settings, BaseUrl = BaseUrl, Capabilities = Capabilities };
|
||||
}
|
||||
|
||||
public override IParseIndexerResponse GetParser()
|
||||
{
|
||||
return new FileListParser(Settings, BaseUrl);
|
||||
return new FileListParser(Settings, BaseUrl, Capabilities.Categories);
|
||||
}
|
||||
|
||||
private IndexerCapabilities SetCapabilities()
|
||||
|
|
|
|||
|
|
@ -22,5 +22,6 @@ public class FileListTorrent
|
|||
public bool DoubleUp { get; set; }
|
||||
[JsonProperty(PropertyName = "upload_date")]
|
||||
public DateTime UploadDate { get; set; }
|
||||
public string Category { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,11 +12,13 @@ public class FileListParser : IParseIndexerResponse
|
|||
{
|
||||
private readonly string _baseUrl;
|
||||
private readonly FileListSettings _settings;
|
||||
private readonly IndexerCapabilitiesCategories _categories;
|
||||
|
||||
public FileListParser(FileListSettings settings, string baseUrl)
|
||||
public FileListParser(FileListSettings settings, string baseUrl, IndexerCapabilitiesCategories categories)
|
||||
{
|
||||
_settings = settings;
|
||||
_baseUrl = baseUrl;
|
||||
_categories = categories;
|
||||
}
|
||||
|
||||
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
||||
|
|
@ -57,6 +59,7 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
|||
Guid = string.Format("FileList-{0}", id),
|
||||
Title = result.Name,
|
||||
Size = result.Size,
|
||||
Category = _categories.MapTrackerCatDescToNewznab(result.Category),
|
||||
DownloadUrl = GetDownloadUrl(id),
|
||||
InfoUrl = GetInfoUrl(id),
|
||||
Seeders = result.Seeders,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ public class FileListRequestGenerator : IIndexerRequestGenerator
|
|||
{
|
||||
public string BaseUrl { get; set; }
|
||||
public FileListSettings Settings { get; set; }
|
||||
public IndexerCapabilities Capabilities { get; set; }
|
||||
public Func<IDictionary<string, string>> GetCookies { get; set; }
|
||||
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
|
||||
|
||||
|
|
@ -106,7 +107,7 @@ public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchC
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue