Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tags import from TMDB configurable #6765

Merged
merged 1 commit into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,15 @@ public class PluginConfiguration : BasePluginConfiguration
/// Gets or sets a value indicating whether include adult content when searching with TMDb.
/// </summary>
public bool IncludeAdult { get; set; }

/// <summary>
/// Gets or sets a value indicating whether tags should be imported for series from TMDb.
/// </summary>
public bool ExcludeTagsSeries { get; set; }

/// <summary>
/// Gets or sets a value indicating whether tags should be imported for movies from TMDb.
/// </summary>
public bool ExcludeTagsMovies { get; set; }
}
}
10 changes: 7 additions & 3 deletions MediaBrowser.Providers/Plugins/Tmdb/Configuration/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,24 @@
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
document.querySelector('#includeAdult').checked = config.IncludeAdult;
document.querySelector('#excludeTagsSeries').checked = config.ExcludeTagsSeries;
document.querySelector('#excludeTagsMovies').checked = config.ExcludeTagsMovies;
Dashboard.hideLoadingMsg();
});
});


document.querySelector('.configForm')
.addEventListener('submit', function (e) {
Dashboard.showLoadingMsg();

ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
config.IncludeAdult = document.querySelector('#includeAdult').checked;
config.ExcludeTagsSeries = document.querySelector('#excludeTagsSeries').checked;
config.ExcludeTagsMovies = document.querySelector('#excludeTagsMovies').checked;
ApiClient.updatePluginConfiguration(PluginConfig.pluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);
});

e.preventDefault();
return false;
});
Expand Down
16 changes: 14 additions & 2 deletions MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,17 @@ public async Task<Movie> GetMovieAsync(int tmdbId, string language, string image

await EnsureClientConfigAsync().ConfigureAwait(false);

var extraMethods = MovieMethods.Credits | MovieMethods.Releases | MovieMethods.Images | MovieMethods.Videos;
if (!(Plugin.Instance?.Configuration.ExcludeTagsMovies).GetValueOrDefault())
{
extraMethods |= MovieMethods.Keywords;
}

movie = await _tmDbClient.GetMovieAsync(
tmdbId,
TmdbUtils.NormalizeLanguage(language),
imageLanguages,
MovieMethods.Credits | MovieMethods.Releases | MovieMethods.Images | MovieMethods.Keywords | MovieMethods.Videos,
extraMethods,
cancellationToken).ConfigureAwait(false);

if (movie != null)
Expand Down Expand Up @@ -123,11 +129,17 @@ public async Task<TvShow> GetSeriesAsync(int tmdbId, string language, string ima

await EnsureClientConfigAsync().ConfigureAwait(false);

var extraMethods = TvShowMethods.Credits | TvShowMethods.Images | TvShowMethods.ExternalIds | TvShowMethods.Videos | TvShowMethods.ContentRatings | TvShowMethods.EpisodeGroups;
if (!(Plugin.Instance?.Configuration.ExcludeTagsSeries).GetValueOrDefault())
{
extraMethods |= TvShowMethods.Keywords;
}

series = await _tmDbClient.GetTvShowAsync(
tmdbId,
language: TmdbUtils.NormalizeLanguage(language),
includeImageLanguage: imageLanguages,
extraMethods: TvShowMethods.Credits | TvShowMethods.Images | TvShowMethods.Keywords | TvShowMethods.ExternalIds | TvShowMethods.Videos | TvShowMethods.ContentRatings | TvShowMethods.EpisodeGroups,
extraMethods: extraMethods,
cancellationToken: cancellationToken).ConfigureAwait(false);

if (series != null)
Expand Down