From c5ca29d2e2bb2db43a3dbf5ae42c1d2a64c857d6 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Tue, 8 Mar 2022 10:36:05 -0500 Subject: [PATCH] Remove unused poster support from StudiosImageProvider (#7423) --- .../StudioImages/StudiosImageProvider.cs | 41 +++++-------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/MediaBrowser.Providers/Plugins/StudioImages/StudiosImageProvider.cs b/MediaBrowser.Providers/Plugins/StudioImages/StudiosImageProvider.cs index e81324a6b3..ce267ac848 100644 --- a/MediaBrowser.Providers/Plugins/StudioImages/StudiosImageProvider.cs +++ b/MediaBrowser.Providers/Plugins/StudioImages/StudiosImageProvider.cs @@ -50,41 +50,29 @@ namespace MediaBrowser.Providers.Studios { return new List { - ImageType.Primary, ImageType.Thumb }; } - public Task> GetImages(BaseItem item, CancellationToken cancellationToken) + public async Task> GetImages(BaseItem item, CancellationToken cancellationToken) { - return GetImages(item, true, true, cancellationToken); - } + var thumbsPath = Path.Combine(_config.ApplicationPaths.CachePath, "imagesbyname", "remotestudiothumbs.txt"); - private async Task> GetImages(BaseItem item, bool posters, bool thumbs, CancellationToken cancellationToken) - { - var list = new List(); - - if (posters) - { - var posterPath = Path.Combine(_config.ApplicationPaths.CachePath, "imagesbyname", "remotestudioposters.txt"); - - posterPath = await EnsurePosterList(posterPath, cancellationToken).ConfigureAwait(false); - - list.Add(GetImage(item, posterPath, ImageType.Primary, "folder")); - } + thumbsPath = await EnsureThumbsList(thumbsPath, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); - if (thumbs) + var imageInfo = GetImage(item, thumbsPath, ImageType.Thumb, "thumb"); + + if (imageInfo == null) { - var thumbsPath = Path.Combine(_config.ApplicationPaths.CachePath, "imagesbyname", "remotestudiothumbs.txt"); - - thumbsPath = await EnsureThumbsList(thumbsPath, cancellationToken).ConfigureAwait(false); - - list.Add(GetImage(item, thumbsPath, ImageType.Thumb, "thumb")); + return Enumerable.Empty(); } - return list.Where(i => i != null); + return new RemoteImageInfo[] + { + imageInfo + }; } private RemoteImageInfo GetImage(BaseItem item, string filename, ImageType type, string remoteFilename) @@ -120,13 +108,6 @@ namespace MediaBrowser.Providers.Studios return EnsureList(url, file, _fileSystem, cancellationToken); } - private Task EnsurePosterList(string file, CancellationToken cancellationToken) - { - string url = string.Format(CultureInfo.InvariantCulture, "{0}/posters.txt", repositoryUrl); - - return EnsureList(url, file, _fileSystem, cancellationToken); - } - public Task GetImageResponse(string url, CancellationToken cancellationToken) { var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);