From a08c5229f3d5faf2959b66687d20ccd6f6b264cb Mon Sep 17 00:00:00 2001 From: Qstick Date: Tue, 9 Mar 2021 22:59:37 -0500 Subject: [PATCH] Fixed: MaM AuthorInfo Object - Round 2 --- .../Indexers/Definitions/MyAnonamouse.cs | 16 ++++++++-------- src/NzbDrone.Core/Indexers/HttpIndexerBase.cs | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Definitions/MyAnonamouse.cs b/src/NzbDrone.Core/Indexers/Definitions/MyAnonamouse.cs index ab2da7df0..7cfe000d0 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/MyAnonamouse.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/MyAnonamouse.cs @@ -41,6 +41,11 @@ namespace NzbDrone.Core.Indexers.Definitions return new MyAnonamouseParser(Settings, Capabilities.Categories, BaseUrl); } + protected override IDictionary GetCookies() + { + return CookieUtil.CookieHeaderToDictionary("mam_id=" + Settings.MamId); + } + private IndexerCapabilities SetCapabilities() { var caps = new IndexerCapabilities @@ -205,11 +210,6 @@ namespace NzbDrone.Core.Indexers.Definitions var request = new IndexerRequest(urlSearch, HttpAccept.Json); - foreach (var cookie in CookieUtil.CookieHeaderToDictionary("mam_id=" + Settings.MamId)) - { - request.HttpRequest.Cookies.Add(cookie.Key, cookie.Value); - } - yield return request; } @@ -290,11 +290,11 @@ namespace NzbDrone.Core.Indexers.Definitions release.Title = item.Title; // release.Description = item.Value("description"); - var authorInfo = item.AuthorInfo; var author = string.Empty; - if (authorInfo != null && authorInfo.Count > 0) + if (item.AuthorInfo != null) { + var authorInfo = JsonConvert.DeserializeObject>(item.AuthorInfo); author = authorInfo.First().Value; } @@ -392,7 +392,7 @@ namespace NzbDrone.Core.Indexers.Definitions public string Title { get; set; } [JsonProperty(PropertyName = "author_info")] - public Dictionary AuthorInfo { get; set; } + public string AuthorInfo { get; set; } [JsonProperty(PropertyName = "lang_code")] public string LangCode { get; set; } diff --git a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs index 7a4437c98..706a8e636 100644 --- a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs @@ -141,7 +141,7 @@ namespace NzbDrone.Core.Indexers return generator; } - protected IDictionary GetCookies() + protected virtual IDictionary GetCookies() { var cookies = _indexerStatusService.GetIndexerCookies(Definition.Id); var expiration = _indexerStatusService.GetIndexerCookiesExpirationDate(Definition.Id);