diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Configuration/PluginConfiguration.cs b/MediaBrowser.Providers/Plugins/Tmdb/Configuration/PluginConfiguration.cs
index 03aaf380b5..e9cd81a14e 100644
--- a/MediaBrowser.Providers/Plugins/Tmdb/Configuration/PluginConfiguration.cs
+++ b/MediaBrowser.Providers/Plugins/Tmdb/Configuration/PluginConfiguration.cs
@@ -7,6 +7,12 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
///
public class PluginConfiguration : BasePluginConfiguration
{
+ ///
+ /// Gets or sets a value to use as the API key for accessing TMDb. This is intentionally excluded from the
+ /// settings page as the API key should not need to be changed by most users.
+ ///
+ public string TmdbApiKey { get; set; } = TmdbUtils.ApiKey;
+
///
/// Gets or sets a value indicating whether include adult content when searching with TMDb.
///
diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Configuration/config.html b/MediaBrowser.Providers/Plugins/Tmdb/Configuration/config.html
index cd21516f95..f3c24e7b42 100644
--- a/MediaBrowser.Providers/Plugins/Tmdb/Configuration/config.html
+++ b/MediaBrowser.Providers/Plugins/Tmdb/Configuration/config.html
@@ -64,9 +64,18 @@
var clientConfig, pluginConfig;
var configureImageScaling = function() {
- if (clientConfig === null || pluginConfig === null) {
+ if (clientConfig === undefined || pluginConfig === undefined) {
return;
}
+ if (Object.keys(clientConfig).length === 0) {
+ clientConfig = {
+ PosterSizes: [pluginConfig.PosterSize],
+ BackdropSizes: [pluginConfig.BackdropSize],
+ LogoSizes: [pluginConfig.LogoSize],
+ ProfileSizes: [pluginConfig.ProfileSize],
+ StillSizes: [pluginConfig.StillSize]
+ };
+ }
var sizeOptionsGenerator = function (size) {
return '';
@@ -104,6 +113,15 @@
ApiClient.fetch(request).then(function (config) {
clientConfig = config;
configureImageScaling();
+ }, function (error) {
+ error.text().then(function (contents) {
+ Dashboard.alert({
+ title: error.statusText,
+ message: contents
+ });
+ clientConfig = {};
+ configureImageScaling();
+ });
});
ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs b/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs
index 72e59c9ac4..1402104334 100644
--- a/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs
+++ b/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs
@@ -36,7 +36,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
public TmdbClientManager(IMemoryCache memoryCache)
{
_memoryCache = memoryCache;
- _tmDbClient = new TMDbClient(TmdbUtils.ApiKey);
+ _tmDbClient = new TMDbClient(Plugin.Instance.Configuration.TmdbApiKey);
// Not really interested in NotFoundException
_tmDbClient.ThrowApiExceptions = false;
}