Added check for anime show type when fetching last activity date

This commit is contained in:
LuciusAezerith 2026-05-02 00:41:48 +02:00
parent bf5d48c76a
commit 5282d17911
4 changed files with 10 additions and 5 deletions

View file

@ -66,6 +66,9 @@ public class SimklSyncActivityResource
{
[JsonProperty("tv_shows")]
public SimklTvSyncActivityResource TvShows { get; set; }
[JsonProperty("anime")]
public SimklTvSyncActivityResource Anime { get; set; }
}
public class SimklTvSyncActivityResource

View file

@ -4,6 +4,7 @@
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.ImportLists.Simkl.User;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
@ -110,7 +111,7 @@ private DateTime GetLastActivity()
if (response?.Resource != null)
{
return response.Resource.TvShows.All;
return (SimklUserShowType)Settings.ShowType == SimklUserShowType.Shows ? response.Resource.TvShows.All : response.Resource.Anime.All;
}
}
catch (HttpException)

View file

@ -2,6 +2,7 @@
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
@ -32,6 +33,7 @@ public class SimklSettingsBase<TSettings> : ImportListSettingsBase<TSettings>
public SimklSettingsBase()
{
SignIn = "startOAuth";
ShowType = (int)SimklUserShowType.Shows;
}
public override string BaseUrl { get; set; } = "https://api.simkl.com";
@ -51,6 +53,9 @@ 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));

View file

@ -19,15 +19,11 @@ public class SimklUserSettings : SimklSettingsBase<SimklUserSettings>
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));