1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-19 17:32:38 +01:00

Original Language filter optional for TMDb Popular lists

This commit is contained in:
Bogdan 2024-07-25 03:18:07 +03:00
parent ddb7d5690b
commit 6ed3045433
2 changed files with 8 additions and 7 deletions

View File

@ -38,7 +38,7 @@ private IEnumerable<ImportListRequest> GetMoviesRequests()
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 @@ private IEnumerable<ImportListRequest> GetMoviesRequests()
.SetSegment("api", "3")
.SetSegment("route", "discover")
.SetSegment("id", "")
.SetSegment("secondaryRoute", "movie");
.SetSegment("secondaryRoute", "movie")
.Accept(HttpAccept.Json);
switch (Settings.TMDbListType)
{
@ -104,9 +105,10 @@ private IEnumerable<ImportListRequest> GetMoviesRequests()
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++)
{

View File

@ -60,7 +60,6 @@ public TMDbFilterSettings()
{
MinVoteAverage = "5";
MinVotes = "1";
LanguageCode = (int)TMDbLanguageCodes.en;
IncludeGenreIds = "";
ExcludeGenreIds = "";
IncludeCompanyIds = "";
@ -89,6 +88,6 @@ public TMDbFilterSettings()
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; }
}
}