mirror of https://github.com/jellyfin/jellyfin.git
Remove unused poster support from StudiosImageProvider (#7423)
This commit is contained in:
parent
03f1eff21a
commit
c5ca29d2e2
|
@ -50,41 +50,29 @@ namespace MediaBrowser.Providers.Studios
|
||||||
{
|
{
|
||||||
return new List<ImageType>
|
return new List<ImageType>
|
||||||
{
|
{
|
||||||
ImageType.Primary,
|
|
||||||
ImageType.Thumb
|
ImageType.Thumb
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return GetImages(item, true, true, cancellationToken);
|
var thumbsPath = Path.Combine(_config.ApplicationPaths.CachePath, "imagesbyname", "remotestudiothumbs.txt");
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, bool posters, bool thumbs, CancellationToken cancellationToken)
|
thumbsPath = await EnsureThumbsList(thumbsPath, cancellationToken).ConfigureAwait(false);
|
||||||
{
|
|
||||||
var list = new List<RemoteImageInfo>();
|
|
||||||
|
|
||||||
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"));
|
|
||||||
}
|
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
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");
|
return Enumerable.Empty<RemoteImageInfo>();
|
||||||
|
|
||||||
thumbsPath = await EnsureThumbsList(thumbsPath, cancellationToken).ConfigureAwait(false);
|
|
||||||
|
|
||||||
list.Add(GetImage(item, thumbsPath, ImageType.Thumb, "thumb"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return list.Where(i => i != null);
|
return new RemoteImageInfo[]
|
||||||
|
{
|
||||||
|
imageInfo
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private RemoteImageInfo GetImage(BaseItem item, string filename, ImageType type, string remoteFilename)
|
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);
|
return EnsureList(url, file, _fileSystem, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task<string> EnsurePosterList(string file, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
string url = string.Format(CultureInfo.InvariantCulture, "{0}/posters.txt", repositoryUrl);
|
|
||||||
|
|
||||||
return EnsureList(url, file, _fileSystem, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
|
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
|
||||||
|
|
Loading…
Reference in New Issue