diff --git a/src/NzbDrone.Core/Migration/JackettMigrationService.cs b/src/NzbDrone.Core/Migration/JackettMigrationService.cs index 00c60bac5..eb89ef21c 100644 --- a/src/NzbDrone.Core/Migration/JackettMigrationService.cs +++ b/src/NzbDrone.Core/Migration/JackettMigrationService.cs @@ -6,24 +6,28 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using NLog; using NzbDrone.Common.Http; +using NzbDrone.Core.Indexers; namespace NzbDrone.Core.Migration { public interface IJackettMigrationService { List GetJackettIndexers(string jackettPath, string jackettApi); - JackettIndexerConfigDefintion GetJackettIndexerConfig(JackettIndexerDefinition jackettIndexerDefinition, string jackettPath, string jackettApi); - void MigrateJackettIndexer(JackettIndexerDefinition jackettIndexer, JackettIndexerConfigDefintion jackettIndexerConfig); + List GetJackettIndexerConfig(JackettIndexerDefinition jackettIndexerDefinition, string jackettPath, string jackettApi); + void MigrateJackettIndexer(JackettIndexerDefinition jackettIndexer, List jackettIndexerConfig); } public class JackettMigrationService : IJackettMigrationService { + private readonly IIndexerFactory _indexerFactory; private readonly Logger _logger; public IHttpClient HttpClient { get; set; } public IHttpRequestBuilderFactory RequestBuilder { get; set; } - public JackettMigrationService(Logger logger) + + public JackettMigrationService(IIndexerFactory indexerFactory, Logger logger) { _logger = logger; + _indexerFactory = indexerFactory; } public List GetJackettIndexers(string jackettPath, string jackettApi) @@ -37,18 +41,18 @@ namespace NzbDrone.Core.Migration return jsonResponse; } - public JackettIndexerConfigDefintion GetJackettIndexerConfig(JackettIndexerDefinition jackettIndexerDefinition, string jackettPath, string jackettApi) + public List GetJackettIndexerConfig(JackettIndexerDefinition jackettIndexerDefinition, string jackettPath, string jackettApi) { _logger.Debug($"Getting config from Jackett for {jackettIndexerDefinition.Name}"); var requestBuilder = BuildRequest(jackettPath, jackettApi, jackettIndexerDefinition.Id); - var jsonResponse = JsonConvert.DeserializeObject(HttpClient.Execute(requestBuilder.Build()).Content); + var jsonResponse = JsonConvert.DeserializeObject>(HttpClient.Execute(requestBuilder.Build()).Content); return jsonResponse; } - public void MigrateJackettIndexer(JackettIndexerDefinition jackettIndexer, JackettIndexerConfigDefintion jackettIndexerConfig) + public void MigrateJackettIndexer(JackettIndexerDefinition jackettIndexer, List jackettIndexerConfig) { _logger.Info($"Creating {jackettIndexer.Name} in Prowlarr");