The Free Software Media System - Server Backend & API
Add TMDb logo handling
Joe Rogers239b5166596a
diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Configuration/PluginConfiguration.cs b/MediaBrowser.Providers/Plugins/Tmdb/Configuration/PluginConfiguration.csindex 92f5306e54..03aaf380b5 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/Configuration/PluginConfiguration.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/Configuration/PluginConfiguration.cs@@ -42,6 +42,11 @@ namespace MediaBrowser.Providers.Plugins.Tmdb/// </summary>public string? BackdropSize { get; set; }+ /// <summary>+ /// Gets or sets a value indicating the logo image size to fetch.+ /// </summary>+ public string? LogoSize { get; set; }+/// <summary>/// Gets or sets a value indicating the profile image size to fetch./// </summary>diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Configuration/config.html b/MediaBrowser.Providers/Plugins/Tmdb/Configuration/config.htmlindex 72bd38ffa3..48ec0535c5 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/Configuration/config.html+++ b/MediaBrowser.Providers/Plugins/Tmdb/Configuration/config.html@@ -36,6 +36,9 @@<div class="selectContainer"><select is="emby-select" id="selectBackdropSize" label="Backdrop"></select></div>+ <div class="selectContainer">+ <select is="emby-select" id="selectLogoSize" label="Logo"></select>+ </div><div class="selectContainer"><select is="emby-select" id="selectProfileSize" label="Profile"></select></div>@@ -76,6 +79,10 @@selBackdropSize.innerHTML = clientConfig.BackdropSizes.map(sizeOptionsGenerator);selBackdropSize.value = pluginConfig.BackdropSize;+ var selLogoSize = document.querySelector('#selectLogoSize');+ selLogoSize.innerHTML = clientConfig.LogoSizes.map(sizeOptionsGenerator);+ selLogoSize.value = pluginConfig.LogoSize;+var selProfileSize = document.querySelector('#selectProfileSize');selProfileSize.innerHTML = clientConfig.ProfileSizes.map(sizeOptionsGenerator);selProfileSize.value = pluginConfig.ProfileSize;@@ -129,6 +136,7 @@config.MaxCastMembers = document.querySelector('#maxCastMembers').value;config.PosterSize = document.querySelector('#selectPosterSize').value;config.BackdropSize = document.querySelector('#selectBackdropSize').value;+ config.LogoSize = document.querySelector('#selectLogoSize').value;config.ProfileSize = document.querySelector('#selectProfileSize').value;config.StillSize = document.querySelector('#selectStillSize').value;ApiClient.updatePluginConfiguration(PluginConfig.pluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieImageProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieImageProvider.csindex f71f7bd10d..16f0089f8f 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieImageProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieImageProvider.cs@@ -44,7 +44,8 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Moviesreturn new List<ImageType>{ImageType.Primary,- ImageType.Backdrop+ ImageType.Backdrop,+ ImageType.Logo};}@@ -85,10 +86,12 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Moviesvar posters = movie.Images.Posters;var backdrops = movie.Images.Backdrops;- var remoteImages = new List<RemoteImageInfo>(posters.Count + backdrops.Count);+ var logos = movie.Images.Logos;+ var remoteImages = new List<RemoteImageInfo>(posters.Count + backdrops.Count + logos.Count);_tmdbClientManager.ConvertPostersToRemoteImageInfo(posters, language, remoteImages);_tmdbClientManager.ConvertBackdropsToRemoteImageInfo(backdrops, language, remoteImages);+ _tmdbClientManager.ConvertLogosToRemoteImageInfo(logos, language, remoteImages);return remoteImages;}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesImageProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesImageProvider.csindex 5ef3736c4f..130d6ce448 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesImageProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesImageProvider.cs@@ -42,7 +42,8 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TVreturn new List<ImageType>{ImageType.Primary,- ImageType.Backdrop+ ImageType.Backdrop,+ ImageType.Logo};}@@ -69,10 +70,12 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TVvar posters = series.Images.Posters;var backdrops = series.Images.Backdrops;- var remoteImages = new List<RemoteImageInfo>(posters.Count + backdrops.Count);+ var logos = series.Images.Logos;+ var remoteImages = new List<RemoteImageInfo>(posters.Count + backdrops.Count + logos.Count);_tmdbClientManager.ConvertPostersToRemoteImageInfo(posters, language, remoteImages);_tmdbClientManager.ConvertBackdropsToRemoteImageInfo(backdrops, language, remoteImages);+ _tmdbClientManager.ConvertLogosToRemoteImageInfo(logos, language, remoteImages);return remoteImages;}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs b/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.csindex 28d6f4d0c1..d78652834d 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs@@ -543,6 +543,17 @@ namespace MediaBrowser.Providers.Plugins.TmdbConvertToRemoteImageInfo(images, Plugin.Instance.Configuration.BackdropSize, ImageType.Backdrop, requestLanguage, results);}+ /// <summary>+ /// Converts logo <see cref="ImageData"/>s into <see cref="RemoteImageInfo"/>s.+ /// </summary>+ /// <param name="images">The input images.</param>+ /// <param name="requestLanguage">The requested language.</param>+ /// <param name="results">The collection to add the remote images into.</param>+ public void ConvertLogosToRemoteImageInfo(List<ImageData> images, string requestLanguage, List<RemoteImageInfo> results)+ {+ ConvertToRemoteImageInfo(images, Plugin.Instance.Configuration.LogoSize, ImageType.Logo, requestLanguage, results);+ }+/// <summary>/// Converts profile <see cref="ImageData"/>s into <see cref="RemoteImageInfo"/>s./// </summary>@@ -622,6 +633,11 @@ namespace MediaBrowser.Providers.Plugins.TmdbpluginConfig.BackdropSize = imageConfig.BackdropSizes[^1];}+ if (!imageConfig.LogoSizes.Contains(pluginConfig.LogoSize))+ {+ pluginConfig.LogoSize = imageConfig.LogoSizes[^1];+ }+if (!imageConfig.ProfileSizes.Contains(pluginConfig.ProfileSize)){pluginConfig.ProfileSize = imageConfig.ProfileSizes[^1];