Fixed: Trakt yearly lists no longer supported

(cherry picked from commit bdd975da0f1587a058c9b44871dd62eaada02467)
This commit is contained in:
Mark McDowall 2025-03-24 19:00:23 -07:00 committed by Bogdan
parent 4b3c29ed93
commit 8efce68922
3 changed files with 26 additions and 2 deletions

View file

@ -1,3 +1,4 @@
using System;
using NzbDrone.Core.Annotations;
namespace NzbDrone.Core.ImportLists.Trakt.Popular
@ -6,27 +7,39 @@ public enum TraktPopularListType
{
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeTrendingMovies")]
Trending = 0,
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypePopularMovies")]
Popular = 1,
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeTopAnticipatedMovies")]
Anticipated = 2,
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeTopBoxOfficeMovies")]
BoxOffice = 3,
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeTopWatchedMoviesByWeek")]
TopWatchedByWeek = 4,
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeTopWatchedMoviesByMonth")]
TopWatchedByMonth = 5,
[Obsolete]
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeTopWatchedMoviesByYear")]
TopWatchedByYear = 6,
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeTopWatchedMoviesOfAllTime")]
TopWatchedByAllTime = 7,
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeRecommendedMoviesByWeek")]
RecommendedByWeek = 8,
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeRecommendedMoviesByMonth")]
RecommendedByMonth = 9,
[Obsolete]
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeRecommendedMoviesByYear")]
RecommendedByYear = 10,
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeRecommendedMoviesOfAllTime")]
RecommendedByAllTime = 11
}

View file

@ -49,7 +49,9 @@ private IEnumerable<ImportListRequest> GetMoviesRequest()
case (int)TraktPopularListType.TopWatchedByMonth:
link += "movies/watched/monthly";
break;
#pragma warning disable CS0612
case (int)TraktPopularListType.TopWatchedByYear:
#pragma warning restore CS0612
link += "movies/watched/yearly";
break;
case (int)TraktPopularListType.TopWatchedByAllTime:
@ -61,11 +63,13 @@ private IEnumerable<ImportListRequest> GetMoviesRequest()
case (int)TraktPopularListType.RecommendedByMonth:
link += "movies/recommended/monthly";
break;
#pragma warning disable CS0612
case (int)TraktPopularListType.RecommendedByYear:
#pragma warning restore CS0612
link += "movies/recommended/yearly";
break;
case (int)TraktPopularListType.RecommendedByAllTime:
link += "movies/recommended/yearly";
link += "movies/recommended/all";
break;
}

View file

@ -10,7 +10,14 @@ public class TraktPopularSettingsValidator : TraktSettingsBaseValidator<TraktPop
{
public TraktPopularSettingsValidator()
{
RuleFor(c => c.TraktListType).NotNull();
RuleFor(c => c.TraktListType)
.NotNull()
#pragma warning disable CS0612
.NotEqual((int)TraktPopularListType.TopWatchedByYear)
.WithMessage("Yearly lists are no longer supported")
.NotEqual((int)TraktPopularListType.RecommendedByYear)
.WithMessage("Yearly lists are no longer supported");
#pragma warning restore CS0612
// Loose validation @TODO
RuleFor(c => c.Rating)