From 3aa68122d269d875e5ceed2004756a3c57c0ac94 Mon Sep 17 00:00:00 2001 From: LuciusAezerith <57662283+LuciusAezerith@users.noreply.github.com> Date: Sat, 2 May 2026 16:31:20 +0200 Subject: [PATCH] Refactor show type handling in Simkl import logic and settings --- .../ImportLists/Simkl/SimklImportBase.cs | 11 ++++++++++- .../ImportLists/Simkl/SimklSettingsBase.cs | 5 ----- .../ImportLists/Simkl/User/SimklUserSettings.cs | 4 ++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/NzbDrone.Core/ImportLists/Simkl/SimklImportBase.cs b/src/NzbDrone.Core/ImportLists/Simkl/SimklImportBase.cs index d1b0dfe9f..5b9e32eeb 100644 --- a/src/NzbDrone.Core/ImportLists/Simkl/SimklImportBase.cs +++ b/src/NzbDrone.Core/ImportLists/Simkl/SimklImportBase.cs @@ -111,7 +111,16 @@ private DateTime GetLastActivity() if (response?.Resource != null) { - return (SimklUserShowType)Settings.ShowType == SimklUserShowType.Shows ? response.Resource.TvShows.All : response.Resource.Anime.All; + var showType = SimklUserShowType.Shows; + + if (Settings is SimklUserSettings userSettings) + { + showType = (SimklUserShowType)userSettings.ShowType; + } + + return showType == SimklUserShowType.Shows + ? response.Resource.TvShows.All + : response.Resource.Anime.All; } } catch (HttpException) diff --git a/src/NzbDrone.Core/ImportLists/Simkl/SimklSettingsBase.cs b/src/NzbDrone.Core/ImportLists/Simkl/SimklSettingsBase.cs index 8a043543e..27ed6086d 100644 --- a/src/NzbDrone.Core/ImportLists/Simkl/SimklSettingsBase.cs +++ b/src/NzbDrone.Core/ImportLists/Simkl/SimklSettingsBase.cs @@ -2,7 +2,6 @@ using FluentValidation; using NzbDrone.Common.Extensions; using NzbDrone.Core.Annotations; -using NzbDrone.Core.ImportLists.Simkl.User; using NzbDrone.Core.Validation; namespace NzbDrone.Core.ImportLists.Simkl @@ -33,7 +32,6 @@ public class SimklSettingsBase : ImportListSettingsBase public SimklSettingsBase() { SignIn = "startOAuth"; - ShowType = (int)SimklUserShowType.Shows; } public override string BaseUrl { get; set; } = "https://api.simkl.com"; @@ -53,9 +51,6 @@ public SimklSettingsBase() [FieldDefinition(99, Label = "ImportListsSimklSettingsAuthenticatewithSimkl", Type = FieldType.OAuth)] public string SignIn { get; set; } - [FieldDefinition(1, Label = "ImportListsSimklSettingsShowType", Type = FieldType.Select, SelectOptions = typeof(SimklUserShowType), HelpText = "ImportListsSimklSettingsShowTypeHelpText")] - public int ShowType { get; set; } - public override NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate((TSettings)this)); diff --git a/src/NzbDrone.Core/ImportLists/Simkl/User/SimklUserSettings.cs b/src/NzbDrone.Core/ImportLists/Simkl/User/SimklUserSettings.cs index ad5f7c6b1..cabd423a9 100644 --- a/src/NzbDrone.Core/ImportLists/Simkl/User/SimklUserSettings.cs +++ b/src/NzbDrone.Core/ImportLists/Simkl/User/SimklUserSettings.cs @@ -19,11 +19,15 @@ public class SimklUserSettings : SimklSettingsBase public SimklUserSettings() { ListType = (int)SimklUserListType.Watching; + ShowType = (int)SimklUserShowType.Shows; } [FieldDefinition(1, Label = "ImportListsSimklSettingsListType", Type = FieldType.Select, SelectOptions = typeof(SimklUserListType), HelpText = "ImportListsSimklSettingsListTypeHelpText")] public int ListType { get; set; } + [FieldDefinition(1, Label = "ImportListsSimklSettingsShowType", Type = FieldType.Select, SelectOptions = typeof(SimklUserShowType), HelpText = "ImportListsSimklSettingsShowTypeHelpText")] + public int ShowType { get; set; } + public override NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this));