From 513a668c40e8a68bd14245459e74dd77921abda9 Mon Sep 17 00:00:00 2001 From: cxfksword <718792+cxfksword@users.noreply.github.com> Date: Sat, 3 Feb 2024 14:04:52 +0800 Subject: [PATCH] feat: add movie logo. close #63 --- Jellyfin.Plugin.MetaShark/Api/TmdbApi.cs | 12 +- .../Configuration/configPage.html | 4 +- .../Providers/MovieImageProvider.cs | 106 +++++++++++------ .../Providers/SeriesImageProvider.cs | 110 ++++++++++++------ 4 files changed, 159 insertions(+), 73 deletions(-) diff --git a/Jellyfin.Plugin.MetaShark/Api/TmdbApi.cs b/Jellyfin.Plugin.MetaShark/Api/TmdbApi.cs index 63bed89..8cf2014 100644 --- a/Jellyfin.Plugin.MetaShark/Api/TmdbApi.cs +++ b/Jellyfin.Plugin.MetaShark/Api/TmdbApi.cs @@ -39,7 +39,7 @@ public TmdbApi(ILoggerFactory loggerFactory) var config = Plugin.Instance?.Configuration; var apiKey = string.IsNullOrEmpty(config?.TmdbApiKey) ? DEFAULT_API_KEY : config.TmdbApiKey; var host = string.IsNullOrEmpty(config?.TmdbHost) ? DEFAULT_API_HOST : config.TmdbHost; - _tmDbClient = new TMDbClient(apiKey, true, host, null, config.GetTmdbWebProxy()); + _tmDbClient = new TMDbClient(apiKey, true, host, null, config?.GetTmdbWebProxy()); _tmDbClient.Timeout = TimeSpan.FromSeconds(10); // Not really interested in NotFoundException _tmDbClient.ThrowApiExceptions = false; @@ -597,6 +597,16 @@ public async Task> SearchCollectionAsync(string return _tmDbClient.GetImageUrl(_tmDbClient.Config.Images.StillSizes[^1], filePath).ToString(); } + public string? GetLogoUrl(string filePath) + { + if (string.IsNullOrEmpty(filePath)) + { + return null; + } + + return _tmDbClient.GetImageUrl(_tmDbClient.Config.Images.LogoSizes[^1], filePath).ToString(); + } + /// public void Dispose() { diff --git a/Jellyfin.Plugin.MetaShark/Configuration/configPage.html b/Jellyfin.Plugin.MetaShark/Configuration/configPage.html index e1ab37c..ac10c4d 100644 --- a/Jellyfin.Plugin.MetaShark/Configuration/configPage.html +++ b/Jellyfin.Plugin.MetaShark/Configuration/configPage.html @@ -94,9 +94,9 @@

TheMovieDb

-
勾选后,当影片在豆瓣找不到背景图时,改使用TheMovieDb的补全
+
勾选后,当影片在豆瓣找不到背景图或商标时,改使用TheMovieDb的补全