Original Language filter optional for TMDb Popular lists

pull/10205/head
Bogdan 4 months ago
parent ddb7d5690b
commit 6ed3045433

@ -38,7 +38,7 @@ namespace NzbDrone.Core.ImportLists.TMDb.Popular
var excludeGenreIds = Settings.FilterCriteria.ExcludeGenreIds; var excludeGenreIds = Settings.FilterCriteria.ExcludeGenreIds;
var includeCompanyIds = Settings.FilterCriteria.IncludeCompanyIds; var includeCompanyIds = Settings.FilterCriteria.IncludeCompanyIds;
var excludeCompanyIds = Settings.FilterCriteria.ExcludeCompanyIds; 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 todaysDate = DateTime.Now.ToString("yyyy-MM-dd");
var threeMonthsAgo = DateTime.Parse(todaysDate).AddMonths(-3).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("api", "3")
.SetSegment("route", "discover") .SetSegment("route", "discover")
.SetSegment("id", "") .SetSegment("id", "")
.SetSegment("secondaryRoute", "movie"); .SetSegment("secondaryRoute", "movie")
.Accept(HttpAccept.Json);
switch (Settings.TMDbListType) switch (Settings.TMDbListType)
{ {
@ -104,9 +105,10 @@ namespace NzbDrone.Core.ImportLists.TMDb.Popular
requestBuilder.AddQueryParam("without_companies", excludeCompanyIds); requestBuilder.AddQueryParam("without_companies", excludeCompanyIds);
} }
requestBuilder if (languageCode.HasValue)
.AddQueryParam("with_original_language", languageCode) {
.Accept(HttpAccept.Json); requestBuilder.AddQueryParam("with_original_language", (TMDbLanguageCodes)languageCode);
}
for (var pageNumber = 1; pageNumber <= MaxPages; pageNumber++) for (var pageNumber = 1; pageNumber <= MaxPages; pageNumber++)
{ {

@ -60,7 +60,6 @@ namespace NzbDrone.Core.ImportLists.TMDb
{ {
MinVoteAverage = "5"; MinVoteAverage = "5";
MinVotes = "1"; MinVotes = "1";
LanguageCode = (int)TMDbLanguageCodes.en;
IncludeGenreIds = ""; IncludeGenreIds = "";
ExcludeGenreIds = ""; ExcludeGenreIds = "";
IncludeCompanyIds = ""; IncludeCompanyIds = "";
@ -89,6 +88,6 @@ namespace NzbDrone.Core.ImportLists.TMDb
public string ExcludeCompanyIds { get; set; } public string ExcludeCompanyIds { get; set; }
[FieldDefinition(8, Label = "Original Language", Type = FieldType.Select, SelectOptions = typeof(TMDbLanguageCodes), HelpText = "Filter by Language")] [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; }
} }
} }

Loading…
Cancel
Save