From 6ed304543317016685ed2d8c615bcfde4ba9a61f Mon Sep 17 00:00:00 2001 From: Bogdan Date: Thu, 25 Jul 2024 03:18:07 +0300 Subject: [PATCH] Original Language filter optional for TMDb Popular lists --- .../TMDb/Popular/TMDbPopularRequestGenerator.cs | 12 +++++++----- .../ImportLists/TMDb/TMDbFilterSettings.cs | 3 +-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/NzbDrone.Core/ImportLists/TMDb/Popular/TMDbPopularRequestGenerator.cs b/src/NzbDrone.Core/ImportLists/TMDb/Popular/TMDbPopularRequestGenerator.cs index 19eef97dc..1e50b386c 100644 --- a/src/NzbDrone.Core/ImportLists/TMDb/Popular/TMDbPopularRequestGenerator.cs +++ b/src/NzbDrone.Core/ImportLists/TMDb/Popular/TMDbPopularRequestGenerator.cs @@ -38,7 +38,7 @@ namespace NzbDrone.Core.ImportLists.TMDb.Popular var excludeGenreIds = Settings.FilterCriteria.ExcludeGenreIds; var includeCompanyIds = Settings.FilterCriteria.IncludeCompanyIds; var excludeCompanyIds = Settings.FilterCriteria.ExcludeCompanyIds; - var languageCode = (TMDbLanguageCodes)Settings.FilterCriteria.LanguageCode; + var languageCode = Settings.FilterCriteria.LanguageCode; var todaysDate = DateTime.Now.ToString("yyyy-MM-dd"); var threeMonthsAgo = DateTime.Parse(todaysDate).AddMonths(-3).ToString("yyyy-MM-dd"); @@ -48,7 +48,8 @@ namespace NzbDrone.Core.ImportLists.TMDb.Popular .SetSegment("api", "3") .SetSegment("route", "discover") .SetSegment("id", "") - .SetSegment("secondaryRoute", "movie"); + .SetSegment("secondaryRoute", "movie") + .Accept(HttpAccept.Json); switch (Settings.TMDbListType) { @@ -104,9 +105,10 @@ namespace NzbDrone.Core.ImportLists.TMDb.Popular requestBuilder.AddQueryParam("without_companies", excludeCompanyIds); } - requestBuilder - .AddQueryParam("with_original_language", languageCode) - .Accept(HttpAccept.Json); + if (languageCode.HasValue) + { + requestBuilder.AddQueryParam("with_original_language", (TMDbLanguageCodes)languageCode); + } for (var pageNumber = 1; pageNumber <= MaxPages; pageNumber++) { diff --git a/src/NzbDrone.Core/ImportLists/TMDb/TMDbFilterSettings.cs b/src/NzbDrone.Core/ImportLists/TMDb/TMDbFilterSettings.cs index 42557986a..be4db510c 100644 --- a/src/NzbDrone.Core/ImportLists/TMDb/TMDbFilterSettings.cs +++ b/src/NzbDrone.Core/ImportLists/TMDb/TMDbFilterSettings.cs @@ -60,7 +60,6 @@ namespace NzbDrone.Core.ImportLists.TMDb { MinVoteAverage = "5"; MinVotes = "1"; - LanguageCode = (int)TMDbLanguageCodes.en; IncludeGenreIds = ""; ExcludeGenreIds = ""; IncludeCompanyIds = ""; @@ -89,6 +88,6 @@ namespace NzbDrone.Core.ImportLists.TMDb public string ExcludeCompanyIds { get; set; } [FieldDefinition(8, Label = "Original Language", Type = FieldType.Select, SelectOptions = typeof(TMDbLanguageCodes), HelpText = "Filter by Language")] - public int LanguageCode { get; set; } + public int? LanguageCode { get; set; } } }