|
@@ -51,9 +51,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
/// <param name="tmdbId">The movie's TMDb id.</param>
|
|
/// <param name="tmdbId">The movie's TMDb id.</param>
|
|
/// <param name="language">The movie's language.</param>
|
|
/// <param name="language">The movie's language.</param>
|
|
/// <param name="imageLanguages">A comma-separated list of image languages.</param>
|
|
/// <param name="imageLanguages">A comma-separated list of image languages.</param>
|
|
|
|
+ /// <param name="countryCode">The country code, ISO 3166-1.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <returns>The TMDb movie or null if not found.</returns>
|
|
/// <returns>The TMDb movie or null if not found.</returns>
|
|
- public async Task<Movie?> GetMovieAsync(int tmdbId, string? language, string? imageLanguages, CancellationToken cancellationToken)
|
|
|
|
|
|
+ public async Task<Movie?> GetMovieAsync(int tmdbId, string? language, string? imageLanguages, string? countryCode, CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
var key = $"movie-{tmdbId.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
var key = $"movie-{tmdbId.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
if (_memoryCache.TryGetValue(key, out Movie? movie))
|
|
if (_memoryCache.TryGetValue(key, out Movie? movie))
|
|
@@ -71,7 +72,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
|
|
|
|
movie = await _tmDbClient.GetMovieAsync(
|
|
movie = await _tmDbClient.GetMovieAsync(
|
|
tmdbId,
|
|
tmdbId,
|
|
- TmdbUtils.NormalizeLanguage(language),
|
|
|
|
|
|
+ TmdbUtils.NormalizeLanguage(language, countryCode),
|
|
imageLanguages,
|
|
imageLanguages,
|
|
extraMethods,
|
|
extraMethods,
|
|
cancellationToken).ConfigureAwait(false);
|
|
cancellationToken).ConfigureAwait(false);
|
|
@@ -90,9 +91,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
/// <param name="tmdbId">The collection's TMDb id.</param>
|
|
/// <param name="tmdbId">The collection's TMDb id.</param>
|
|
/// <param name="language">The collection's language.</param>
|
|
/// <param name="language">The collection's language.</param>
|
|
/// <param name="imageLanguages">A comma-separated list of image languages.</param>
|
|
/// <param name="imageLanguages">A comma-separated list of image languages.</param>
|
|
|
|
+ /// <param name="countryCode">The country code, ISO 3166-1.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <returns>The TMDb collection or null if not found.</returns>
|
|
/// <returns>The TMDb collection or null if not found.</returns>
|
|
- public async Task<Collection?> GetCollectionAsync(int tmdbId, string? language, string? imageLanguages, CancellationToken cancellationToken)
|
|
|
|
|
|
+ public async Task<Collection?> GetCollectionAsync(int tmdbId, string? language, string? imageLanguages, string? countryCode, CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
var key = $"collection-{tmdbId.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
var key = $"collection-{tmdbId.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
if (_memoryCache.TryGetValue(key, out Collection? collection))
|
|
if (_memoryCache.TryGetValue(key, out Collection? collection))
|
|
@@ -104,7 +106,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
|
|
|
|
collection = await _tmDbClient.GetCollectionAsync(
|
|
collection = await _tmDbClient.GetCollectionAsync(
|
|
tmdbId,
|
|
tmdbId,
|
|
- TmdbUtils.NormalizeLanguage(language),
|
|
|
|
|
|
+ TmdbUtils.NormalizeLanguage(language, countryCode),
|
|
imageLanguages,
|
|
imageLanguages,
|
|
CollectionMethods.Images,
|
|
CollectionMethods.Images,
|
|
cancellationToken).ConfigureAwait(false);
|
|
cancellationToken).ConfigureAwait(false);
|
|
@@ -123,9 +125,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
/// <param name="tmdbId">The tv show's TMDb id.</param>
|
|
/// <param name="tmdbId">The tv show's TMDb id.</param>
|
|
/// <param name="language">The tv show's language.</param>
|
|
/// <param name="language">The tv show's language.</param>
|
|
/// <param name="imageLanguages">A comma-separated list of image languages.</param>
|
|
/// <param name="imageLanguages">A comma-separated list of image languages.</param>
|
|
|
|
+ /// <param name="countryCode">The country code, ISO 3166-1.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <returns>The TMDb tv show information or null if not found.</returns>
|
|
/// <returns>The TMDb tv show information or null if not found.</returns>
|
|
- public async Task<TvShow?> GetSeriesAsync(int tmdbId, string? language, string? imageLanguages, CancellationToken cancellationToken)
|
|
|
|
|
|
+ public async Task<TvShow?> GetSeriesAsync(int tmdbId, string? language, string? imageLanguages, string? countryCode, CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
var key = $"series-{tmdbId.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
var key = $"series-{tmdbId.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
if (_memoryCache.TryGetValue(key, out TvShow? series))
|
|
if (_memoryCache.TryGetValue(key, out TvShow? series))
|
|
@@ -143,7 +146,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
|
|
|
|
series = await _tmDbClient.GetTvShowAsync(
|
|
series = await _tmDbClient.GetTvShowAsync(
|
|
tmdbId,
|
|
tmdbId,
|
|
- language: TmdbUtils.NormalizeLanguage(language),
|
|
|
|
|
|
+ language: TmdbUtils.NormalizeLanguage(language, countryCode),
|
|
includeImageLanguage: imageLanguages,
|
|
includeImageLanguage: imageLanguages,
|
|
extraMethods: extraMethods,
|
|
extraMethods: extraMethods,
|
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
|
@@ -163,9 +166,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
/// <param name="displayOrder">The display order.</param>
|
|
/// <param name="displayOrder">The display order.</param>
|
|
/// <param name="language">The tv show's language.</param>
|
|
/// <param name="language">The tv show's language.</param>
|
|
/// <param name="imageLanguages">A comma-separated list of image languages.</param>
|
|
/// <param name="imageLanguages">A comma-separated list of image languages.</param>
|
|
|
|
+ /// <param name="countryCode">The country code, ISO 3166-1.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <returns>The TMDb tv show episode group information or null if not found.</returns>
|
|
/// <returns>The TMDb tv show episode group information or null if not found.</returns>
|
|
- private async Task<TvGroupCollection?> GetSeriesGroupAsync(int tvShowId, string displayOrder, string? language, string? imageLanguages, CancellationToken cancellationToken)
|
|
|
|
|
|
+ private async Task<TvGroupCollection?> GetSeriesGroupAsync(int tvShowId, string displayOrder, string? language, string? imageLanguages, string? countryCode, CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
TvGroupType? groupType =
|
|
TvGroupType? groupType =
|
|
string.Equals(displayOrder, "originalAirDate", StringComparison.Ordinal) ? TvGroupType.OriginalAirDate :
|
|
string.Equals(displayOrder, "originalAirDate", StringComparison.Ordinal) ? TvGroupType.OriginalAirDate :
|
|
@@ -190,7 +194,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
|
|
|
|
await EnsureClientConfigAsync().ConfigureAwait(false);
|
|
await EnsureClientConfigAsync().ConfigureAwait(false);
|
|
|
|
|
|
- var series = await GetSeriesAsync(tvShowId, language, imageLanguages, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
+ var series = await GetSeriesAsync(tvShowId, language, imageLanguages, countryCode, cancellationToken).ConfigureAwait(false);
|
|
var episodeGroupId = series?.EpisodeGroups.Results.Find(g => g.Type == groupType)?.Id;
|
|
var episodeGroupId = series?.EpisodeGroups.Results.Find(g => g.Type == groupType)?.Id;
|
|
|
|
|
|
if (episodeGroupId is null)
|
|
if (episodeGroupId is null)
|
|
@@ -200,7 +204,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
|
|
|
|
group = await _tmDbClient.GetTvEpisodeGroupsAsync(
|
|
group = await _tmDbClient.GetTvEpisodeGroupsAsync(
|
|
episodeGroupId,
|
|
episodeGroupId,
|
|
- language: TmdbUtils.NormalizeLanguage(language),
|
|
|
|
|
|
+ language: TmdbUtils.NormalizeLanguage(language, countryCode),
|
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
if (group is not null)
|
|
if (group is not null)
|
|
@@ -218,9 +222,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
/// <param name="seasonNumber">The season number.</param>
|
|
/// <param name="seasonNumber">The season number.</param>
|
|
/// <param name="language">The tv season's language.</param>
|
|
/// <param name="language">The tv season's language.</param>
|
|
/// <param name="imageLanguages">A comma-separated list of image languages.</param>
|
|
/// <param name="imageLanguages">A comma-separated list of image languages.</param>
|
|
|
|
+ /// <param name="countryCode">The country code, ISO 3166-1.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <returns>The TMDb tv season information or null if not found.</returns>
|
|
/// <returns>The TMDb tv season information or null if not found.</returns>
|
|
- public async Task<TvSeason?> GetSeasonAsync(int tvShowId, int seasonNumber, string? language, string? imageLanguages, CancellationToken cancellationToken)
|
|
|
|
|
|
+ public async Task<TvSeason?> GetSeasonAsync(int tvShowId, int seasonNumber, string? language, string? imageLanguages, string? countryCode, CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
var key = $"season-{tvShowId.ToString(CultureInfo.InvariantCulture)}-s{seasonNumber.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
var key = $"season-{tvShowId.ToString(CultureInfo.InvariantCulture)}-s{seasonNumber.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
if (_memoryCache.TryGetValue(key, out TvSeason? season))
|
|
if (_memoryCache.TryGetValue(key, out TvSeason? season))
|
|
@@ -233,7 +238,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
season = await _tmDbClient.GetTvSeasonAsync(
|
|
season = await _tmDbClient.GetTvSeasonAsync(
|
|
tvShowId,
|
|
tvShowId,
|
|
seasonNumber,
|
|
seasonNumber,
|
|
- language: TmdbUtils.NormalizeLanguage(language),
|
|
|
|
|
|
+ language: TmdbUtils.NormalizeLanguage(language, countryCode),
|
|
includeImageLanguage: imageLanguages,
|
|
includeImageLanguage: imageLanguages,
|
|
extraMethods: TvSeasonMethods.Credits | TvSeasonMethods.Images | TvSeasonMethods.ExternalIds | TvSeasonMethods.Videos,
|
|
extraMethods: TvSeasonMethods.Credits | TvSeasonMethods.Images | TvSeasonMethods.ExternalIds | TvSeasonMethods.Videos,
|
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
|
@@ -255,9 +260,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
/// <param name="displayOrder">The display order.</param>
|
|
/// <param name="displayOrder">The display order.</param>
|
|
/// <param name="language">The episode's language.</param>
|
|
/// <param name="language">The episode's language.</param>
|
|
/// <param name="imageLanguages">A comma-separated list of image languages.</param>
|
|
/// <param name="imageLanguages">A comma-separated list of image languages.</param>
|
|
|
|
+ /// <param name="countryCode">The country code, ISO 3166-1.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <returns>The TMDb tv episode information or null if not found.</returns>
|
|
/// <returns>The TMDb tv episode information or null if not found.</returns>
|
|
- public async Task<TvEpisode?> GetEpisodeAsync(int tvShowId, int seasonNumber, int episodeNumber, string displayOrder, string? language, string? imageLanguages, CancellationToken cancellationToken)
|
|
|
|
|
|
+ public async Task<TvEpisode?> GetEpisodeAsync(int tvShowId, int seasonNumber, int episodeNumber, string displayOrder, string? language, string? imageLanguages, string? countryCode, CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
var key = $"episode-{tvShowId.ToString(CultureInfo.InvariantCulture)}-s{seasonNumber.ToString(CultureInfo.InvariantCulture)}e{episodeNumber.ToString(CultureInfo.InvariantCulture)}-{displayOrder}-{language}";
|
|
var key = $"episode-{tvShowId.ToString(CultureInfo.InvariantCulture)}-s{seasonNumber.ToString(CultureInfo.InvariantCulture)}e{episodeNumber.ToString(CultureInfo.InvariantCulture)}-{displayOrder}-{language}";
|
|
if (_memoryCache.TryGetValue(key, out TvEpisode? episode))
|
|
if (_memoryCache.TryGetValue(key, out TvEpisode? episode))
|
|
@@ -267,7 +273,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
|
|
|
|
await EnsureClientConfigAsync().ConfigureAwait(false);
|
|
await EnsureClientConfigAsync().ConfigureAwait(false);
|
|
|
|
|
|
- var group = await GetSeriesGroupAsync(tvShowId, displayOrder, language, imageLanguages, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
+ var group = await GetSeriesGroupAsync(tvShowId, displayOrder, language, imageLanguages, countryCode, cancellationToken).ConfigureAwait(false);
|
|
if (group is not null)
|
|
if (group is not null)
|
|
{
|
|
{
|
|
var season = group.Groups.Find(s => s.Order == seasonNumber);
|
|
var season = group.Groups.Find(s => s.Order == seasonNumber);
|
|
@@ -284,7 +290,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
tvShowId,
|
|
tvShowId,
|
|
seasonNumber,
|
|
seasonNumber,
|
|
episodeNumber,
|
|
episodeNumber,
|
|
- language: TmdbUtils.NormalizeLanguage(language),
|
|
|
|
|
|
+ language: TmdbUtils.NormalizeLanguage(language, countryCode),
|
|
includeImageLanguage: imageLanguages,
|
|
includeImageLanguage: imageLanguages,
|
|
extraMethods: TvEpisodeMethods.Credits | TvEpisodeMethods.Images | TvEpisodeMethods.ExternalIds | TvEpisodeMethods.Videos,
|
|
extraMethods: TvEpisodeMethods.Credits | TvEpisodeMethods.Images | TvEpisodeMethods.ExternalIds | TvEpisodeMethods.Videos,
|
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
|
@@ -301,10 +307,11 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
/// Gets a person eg. cast or crew member from the TMDb API based on its TMDb id.
|
|
/// Gets a person eg. cast or crew member from the TMDb API based on its TMDb id.
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="personTmdbId">The person's TMDb id.</param>
|
|
/// <param name="personTmdbId">The person's TMDb id.</param>
|
|
- /// <param name="language">The episode's language.</param>
|
|
|
|
|
|
+ /// <param name="language">The person's language.</param>
|
|
|
|
+ /// <param name="countryCode">The country code, ISO 3166-1.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <returns>The TMDb person information or null if not found.</returns>
|
|
/// <returns>The TMDb person information or null if not found.</returns>
|
|
- public async Task<Person?> GetPersonAsync(int personTmdbId, string language, CancellationToken cancellationToken)
|
|
|
|
|
|
+ public async Task<Person?> GetPersonAsync(int personTmdbId, string language, string? countryCode, CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
var key = $"person-{personTmdbId.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
var key = $"person-{personTmdbId.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
if (_memoryCache.TryGetValue(key, out Person? person))
|
|
if (_memoryCache.TryGetValue(key, out Person? person))
|
|
@@ -316,7 +323,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
|
|
|
|
person = await _tmDbClient.GetPersonAsync(
|
|
person = await _tmDbClient.GetPersonAsync(
|
|
personTmdbId,
|
|
personTmdbId,
|
|
- TmdbUtils.NormalizeLanguage(language),
|
|
|
|
|
|
+ TmdbUtils.NormalizeLanguage(language, countryCode),
|
|
PersonMethods.TvCredits | PersonMethods.MovieCredits | PersonMethods.Images | PersonMethods.ExternalIds,
|
|
PersonMethods.TvCredits | PersonMethods.MovieCredits | PersonMethods.Images | PersonMethods.ExternalIds,
|
|
cancellationToken).ConfigureAwait(false);
|
|
cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
@@ -334,12 +341,14 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
/// <param name="externalId">The item's external id.</param>
|
|
/// <param name="externalId">The item's external id.</param>
|
|
/// <param name="source">The source of the id eg. IMDb.</param>
|
|
/// <param name="source">The source of the id eg. IMDb.</param>
|
|
/// <param name="language">The item's language.</param>
|
|
/// <param name="language">The item's language.</param>
|
|
|
|
+ /// <param name="countryCode">The country code, ISO 3166-1.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <returns>The TMDb item or null if not found.</returns>
|
|
/// <returns>The TMDb item or null if not found.</returns>
|
|
public async Task<FindContainer?> FindByExternalIdAsync(
|
|
public async Task<FindContainer?> FindByExternalIdAsync(
|
|
string externalId,
|
|
string externalId,
|
|
FindExternalSource source,
|
|
FindExternalSource source,
|
|
string language,
|
|
string language,
|
|
|
|
+ string? countryCode,
|
|
CancellationToken cancellationToken)
|
|
CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
var key = $"find-{source.ToString()}-{externalId.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
var key = $"find-{source.ToString()}-{externalId.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
@@ -353,7 +362,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
result = await _tmDbClient.FindAsync(
|
|
result = await _tmDbClient.FindAsync(
|
|
source,
|
|
source,
|
|
externalId,
|
|
externalId,
|
|
- TmdbUtils.NormalizeLanguage(language),
|
|
|
|
|
|
+ TmdbUtils.NormalizeLanguage(language, countryCode),
|
|
cancellationToken).ConfigureAwait(false);
|
|
cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
if (result is not null)
|
|
if (result is not null)
|
|
@@ -369,10 +378,11 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="name">The name of the tv show.</param>
|
|
/// <param name="name">The name of the tv show.</param>
|
|
/// <param name="language">The tv show's language.</param>
|
|
/// <param name="language">The tv show's language.</param>
|
|
|
|
+ /// <param name="countryCode">The country code, ISO 3166-1.</param>
|
|
/// <param name="year">The year the tv show first aired.</param>
|
|
/// <param name="year">The year the tv show first aired.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <returns>The TMDb tv show information.</returns>
|
|
/// <returns>The TMDb tv show information.</returns>
|
|
- public async Task<IReadOnlyList<SearchTv>> SearchSeriesAsync(string name, string language, int year = 0, CancellationToken cancellationToken = default)
|
|
|
|
|
|
+ public async Task<IReadOnlyList<SearchTv>> SearchSeriesAsync(string name, string language, string? countryCode, int year = 0, CancellationToken cancellationToken = default)
|
|
{
|
|
{
|
|
var key = $"searchseries-{name}-{year.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
var key = $"searchseries-{name}-{year.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
if (_memoryCache.TryGetValue(key, out SearchContainer<SearchTv>? series) && series is not null)
|
|
if (_memoryCache.TryGetValue(key, out SearchContainer<SearchTv>? series) && series is not null)
|
|
@@ -383,7 +393,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
await EnsureClientConfigAsync().ConfigureAwait(false);
|
|
await EnsureClientConfigAsync().ConfigureAwait(false);
|
|
|
|
|
|
var searchResults = await _tmDbClient
|
|
var searchResults = await _tmDbClient
|
|
- .SearchTvShowAsync(name, TmdbUtils.NormalizeLanguage(language), includeAdult: Plugin.Instance.Configuration.IncludeAdult, firstAirDateYear: year, cancellationToken: cancellationToken)
|
|
|
|
|
|
+ .SearchTvShowAsync(name, TmdbUtils.NormalizeLanguage(language, countryCode), includeAdult: Plugin.Instance.Configuration.IncludeAdult, firstAirDateYear: year, cancellationToken: cancellationToken)
|
|
.ConfigureAwait(false);
|
|
.ConfigureAwait(false);
|
|
|
|
|
|
if (searchResults.Results.Count > 0)
|
|
if (searchResults.Results.Count > 0)
|
|
@@ -431,7 +441,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
/// <returns>The TMDb movie information.</returns>
|
|
/// <returns>The TMDb movie information.</returns>
|
|
public Task<IReadOnlyList<SearchMovie>> SearchMovieAsync(string name, string language, CancellationToken cancellationToken)
|
|
public Task<IReadOnlyList<SearchMovie>> SearchMovieAsync(string name, string language, CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
- return SearchMovieAsync(name, 0, language, cancellationToken);
|
|
|
|
|
|
+ return SearchMovieAsync(name, 0, language, null, cancellationToken);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -440,9 +450,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
/// <param name="name">The name of the movie.</param>
|
|
/// <param name="name">The name of the movie.</param>
|
|
/// <param name="year">The release year of the movie.</param>
|
|
/// <param name="year">The release year of the movie.</param>
|
|
/// <param name="language">The movie's language.</param>
|
|
/// <param name="language">The movie's language.</param>
|
|
|
|
+ /// <param name="countryCode">The country code, ISO 3166-1.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <returns>The TMDb movie information.</returns>
|
|
/// <returns>The TMDb movie information.</returns>
|
|
- public async Task<IReadOnlyList<SearchMovie>> SearchMovieAsync(string name, int year, string language, CancellationToken cancellationToken)
|
|
|
|
|
|
+ public async Task<IReadOnlyList<SearchMovie>> SearchMovieAsync(string name, int year, string language, string? countryCode, CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
var key = $"moviesearch-{name}-{year.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
var key = $"moviesearch-{name}-{year.ToString(CultureInfo.InvariantCulture)}-{language}";
|
|
if (_memoryCache.TryGetValue(key, out SearchContainer<SearchMovie>? movies) && movies is not null)
|
|
if (_memoryCache.TryGetValue(key, out SearchContainer<SearchMovie>? movies) && movies is not null)
|
|
@@ -453,7 +464,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
await EnsureClientConfigAsync().ConfigureAwait(false);
|
|
await EnsureClientConfigAsync().ConfigureAwait(false);
|
|
|
|
|
|
var searchResults = await _tmDbClient
|
|
var searchResults = await _tmDbClient
|
|
- .SearchMovieAsync(name, TmdbUtils.NormalizeLanguage(language), includeAdult: Plugin.Instance.Configuration.IncludeAdult, year: year, cancellationToken: cancellationToken)
|
|
|
|
|
|
+ .SearchMovieAsync(name, TmdbUtils.NormalizeLanguage(language, countryCode), includeAdult: Plugin.Instance.Configuration.IncludeAdult, year: year, cancellationToken: cancellationToken)
|
|
.ConfigureAwait(false);
|
|
.ConfigureAwait(false);
|
|
|
|
|
|
if (searchResults.Results.Count > 0)
|
|
if (searchResults.Results.Count > 0)
|
|
@@ -469,9 +480,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="name">The name of the collection.</param>
|
|
/// <param name="name">The name of the collection.</param>
|
|
/// <param name="language">The collection's language.</param>
|
|
/// <param name="language">The collection's language.</param>
|
|
|
|
+ /// <param name="countryCode">The country code, ISO 3166-1.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <returns>The TMDb collection information.</returns>
|
|
/// <returns>The TMDb collection information.</returns>
|
|
- public async Task<IReadOnlyList<SearchCollection>> SearchCollectionAsync(string name, string language, CancellationToken cancellationToken)
|
|
|
|
|
|
+ public async Task<IReadOnlyList<SearchCollection>> SearchCollectionAsync(string name, string language, string? countryCode, CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
var key = $"collectionsearch-{name}-{language}";
|
|
var key = $"collectionsearch-{name}-{language}";
|
|
if (_memoryCache.TryGetValue(key, out SearchContainer<SearchCollection>? collections) && collections is not null)
|
|
if (_memoryCache.TryGetValue(key, out SearchContainer<SearchCollection>? collections) && collections is not null)
|
|
@@ -482,7 +494,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|
await EnsureClientConfigAsync().ConfigureAwait(false);
|
|
await EnsureClientConfigAsync().ConfigureAwait(false);
|
|
|
|
|
|
var searchResults = await _tmDbClient
|
|
var searchResults = await _tmDbClient
|
|
- .SearchCollectionAsync(name, TmdbUtils.NormalizeLanguage(language), cancellationToken: cancellationToken)
|
|
|
|
|
|
+ .SearchCollectionAsync(name, TmdbUtils.NormalizeLanguage(language, countryCode), cancellationToken: cancellationToken)
|
|
.ConfigureAwait(false);
|
|
.ConfigureAwait(false);
|
|
|
|
|
|
if (searchResults.Results.Count > 0)
|
|
if (searchResults.Results.Count > 0)
|