diff --git a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/Cardigann.cs b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/Cardigann.cs index 974956555..2d01ba5f0 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/Cardigann.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/Cardigann.cs @@ -223,6 +223,11 @@ namespace NzbDrone.Core.Indexers.Cardigann } } + public override IDictionary GrabCookies() + { + return ((CardigannRequestGenerator)GetRequestGenerator()).Cookies; + } + public override object RequestAction(string action, IDictionary query) { if (action == "checkCaptcha") diff --git a/src/NzbDrone.Core/Indexers/IIndexer.cs b/src/NzbDrone.Core/Indexers/IIndexer.cs index aa7c5d9c0..39e58c762 100644 --- a/src/NzbDrone.Core/Indexers/IIndexer.cs +++ b/src/NzbDrone.Core/Indexers/IIndexer.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using NzbDrone.Core.IndexerSearch.Definitions; @@ -28,6 +29,8 @@ namespace NzbDrone.Core.Indexers Task Download(Uri link); + IDictionary GrabCookies(); + IndexerCapabilities GetCapabilities(); } } diff --git a/src/NzbDrone.Core/Indexers/IndexerBase.cs b/src/NzbDrone.Core/Indexers/IndexerBase.cs index f2f0b6ca7..1632b7d69 100644 --- a/src/NzbDrone.Core/Indexers/IndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/IndexerBase.cs @@ -125,5 +125,10 @@ namespace NzbDrone.Core.Indexers { return Definition.Name; } + + public virtual IDictionary GrabCookies() + { + return null; + } } } diff --git a/src/NzbDrone.Core/Indexers/IndexerFactory.cs b/src/NzbDrone.Core/Indexers/IndexerFactory.cs index bf5aaa99c..2f78b94b2 100644 --- a/src/NzbDrone.Core/Indexers/IndexerFactory.cs +++ b/src/NzbDrone.Core/Indexers/IndexerFactory.cs @@ -267,7 +267,13 @@ namespace NzbDrone.Core.Indexers MapCardigannDefinition(definition); } - return base.Create(definition); + var newDef = base.Create(definition); + + provider.Definition = newDef; + + _indexerStatusService.UpdateCookies(newDef.Id, provider.GrabCookies(), DateTime.Now + TimeSpan.FromDays(30)); + + return newDef; } public override void Update(IndexerDefinition definition)