New: Add Recommended to the List types for Trakt

Closes #4167
This commit is contained in:
Michael Casey 2021-02-28 06:18:07 +10:00 committed by GitHub
parent 4e81b33006
commit cb8ed74fe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 10 deletions

View File

@ -18,6 +18,14 @@ namespace NzbDrone.Core.ImportLists.Trakt.Popular
[EnumMember(Value = "Top Watched Shows By Year")] [EnumMember(Value = "Top Watched Shows By Year")]
TopWatchedByYear = 5, TopWatchedByYear = 5,
[EnumMember(Value = "Top Watched Shows Of All Time")] [EnumMember(Value = "Top Watched Shows Of All Time")]
TopWatchedByAllTime = 6 TopWatchedByAllTime = 6,
[EnumMember(Value = "Recommended Shows By Week")]
RecommendedByWeek = 7,
[EnumMember(Value = "Recommended Shows By Month")]
RecommendedByMonth = 8,
[EnumMember(Value = "Recommended Shows By Year")]
RecommendedByYear = 9,
[EnumMember(Value = "Recommended Shows Of All Time")]
RecommendedByAllTime = 10
} }
} }

View File

@ -27,33 +27,46 @@ namespace NzbDrone.Core.ImportLists.Trakt.Popular
{ {
var link = Settings.BaseUrl.Trim(); var link = Settings.BaseUrl.Trim();
var filtersAndLimit = $"?years={Settings.Years}&genres={Settings.Genres.ToLower()}&ratings={Settings.Rating}&limit={Settings.Limit}{Settings.TraktAdditionalParameters}";
switch (Settings.TraktListType) switch (Settings.TraktListType)
{ {
case (int)TraktPopularListType.Trending: case (int)TraktPopularListType.Trending:
link += "/shows/trending" + filtersAndLimit; link += "/shows/trending";
break; break;
case (int)TraktPopularListType.Popular: case (int)TraktPopularListType.Popular:
link += "/shows/popular" + filtersAndLimit; link += "/shows/popular";
break; break;
case (int)TraktPopularListType.Anticipated: case (int)TraktPopularListType.Anticipated:
link += "/shows/anticipated" + filtersAndLimit; link += "/shows/anticipated";
break; break;
case (int)TraktPopularListType.TopWatchedByWeek: case (int)TraktPopularListType.TopWatchedByWeek:
link += "/shows/watched/weekly" + filtersAndLimit; link += "/shows/watched/weekly";
break; break;
case (int)TraktPopularListType.TopWatchedByMonth: case (int)TraktPopularListType.TopWatchedByMonth:
link += "/shows/watched/monthly" + filtersAndLimit; link += "/shows/watched/monthly";
break; break;
case (int)TraktPopularListType.TopWatchedByYear: case (int)TraktPopularListType.TopWatchedByYear:
link += "/shows/watched/yearly" + filtersAndLimit; link += "/shows/watched/yearly";
break; break;
case (int)TraktPopularListType.TopWatchedByAllTime: case (int)TraktPopularListType.TopWatchedByAllTime:
link += "/shows/watched/all" + filtersAndLimit; link += "/shows/watched/all";
break;
case (int)TraktPopularListType.RecommendedByWeek:
link += "/shows/recommended/weekly";
break;
case (int)TraktPopularListType.RecommendedByMonth:
link += "/shows/recommended/monthly";
break;
case (int)TraktPopularListType.RecommendedByYear:
link += "/shows/recommended/yearly";
break;
case (int)TraktPopularListType.RecommendedByAllTime:
link += "/shows/recommended/yearly";
break; break;
} }
var filtersAndLimit = $"?years={Settings.Years}&genres={Settings.Genres.ToLower()}&ratings={Settings.Rating}&limit={Settings.Limit}{Settings.TraktAdditionalParameters}";
link += filtersAndLimit;
var request = new ImportListRequest($"{link}", HttpAccept.Json); var request = new ImportListRequest($"{link}", HttpAccept.Json);
request.HttpRequest.Headers.Add("trakt-api-version", "2"); request.HttpRequest.Headers.Add("trakt-api-version", "2");