aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Rogers <1337joe@gmail.com>2021-10-22 00:35:14 +0200
committerJoe Rogers <1337joe@gmail.com>2022-01-19 09:54:52 +0100
commit239b5166596adefa159d263e4744b5d0d6fca072 (patch)
tree63ec873bddc89dd62925bc4d2ec65ee0609d51a7
parent7500c2b28b4603965461b7bce37413c0a53ff2d0 (diff)
Add TMDb logo handling
-rw-r--r--MediaBrowser.Providers/Plugins/Tmdb/Configuration/PluginConfiguration.cs5
-rw-r--r--MediaBrowser.Providers/Plugins/Tmdb/Configuration/config.html8
-rw-r--r--MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieImageProvider.cs7
-rw-r--r--MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesImageProvider.cs7
-rw-r--r--MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs16
5 files changed, 39 insertions, 4 deletions
diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Configuration/PluginConfiguration.cs b/MediaBrowser.Providers/Plugins/Tmdb/Configuration/PluginConfiguration.cs
index 92f5306e5..03aaf380b 100644
--- a/MediaBrowser.Providers/Plugins/Tmdb/Configuration/PluginConfiguration.cs
+++ b/MediaBrowser.Providers/Plugins/Tmdb/Configuration/PluginConfiguration.cs
@@ -43,6 +43,11 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
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>
public string? ProfileSize { get; set; }
diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Configuration/config.html b/MediaBrowser.Providers/Plugins/Tmdb/Configuration/config.html
index 72bd38ffa..48ec0535c 100644
--- a/MediaBrowser.Providers/Plugins/Tmdb/Configuration/config.html
+++ b/MediaBrowser.Providers/Plugins/Tmdb/Configuration/config.html
@@ -37,6 +37,9 @@
<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>
<div class="selectContainer">
@@ -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.cs
index f71f7bd10..16f0089f8 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.Movies
return new List<ImageType>
{
ImageType.Primary,
- ImageType.Backdrop
+ ImageType.Backdrop,
+ ImageType.Logo
};
}
@@ -85,10 +86,12 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
var 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.cs
index 5ef3736c4..130d6ce44 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.TV
return new List<ImageType>
{
ImageType.Primary,
- ImageType.Backdrop
+ ImageType.Backdrop,
+ ImageType.Logo
};
}
@@ -69,10 +70,12 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
var 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.cs
index 28d6f4d0c..d78652834 100644
--- a/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs
+++ b/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs
@@ -544,6 +544,17 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
}
/// <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>
/// <param name="images">The input images.</param>
@@ -622,6 +633,11 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
pluginConfig.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];