diff --git a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileList.cs b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileList.cs index dab71f775..cb22594b7 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileList.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileList.cs @@ -24,12 +24,12 @@ namespace NzbDrone.Core.Indexers.FileList 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() diff --git a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListApi.cs b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListApi.cs index 6a8031915..b92766e14 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListApi.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListApi.cs @@ -22,5 +22,6 @@ namespace NzbDrone.Core.Indexers.FileList public bool DoubleUp { get; set; } [JsonProperty(PropertyName = "upload_date")] public DateTime UploadDate { get; set; } + public string Category { get; set; } } } diff --git a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListParser.cs b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListParser.cs index 18822b9e0..45bf87006 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListParser.cs @@ -12,11 +12,13 @@ namespace NzbDrone.Core.Indexers.FileList { 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 ParseResponse(IndexerResponse indexerResponse) @@ -57,6 +59,7 @@ namespace NzbDrone.Core.Indexers.FileList 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, diff --git a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs index f0b166bad..717190644 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs @@ -11,6 +11,7 @@ namespace NzbDrone.Core.Indexers.FileList { public string BaseUrl { get; set; } public FileListSettings Settings { get; set; } + public IndexerCapabilities Capabilities { get; set; } public Func> GetCookies { get; set; } public Action, DateTime?> CookiesUpdater { get; set; } @@ -106,7 +107,7 @@ namespace NzbDrone.Core.Indexers.FileList private IEnumerable 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);