|
|
@ -299,22 +299,26 @@ namespace MediaBrowser.Api
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var result = await _providerManager.GetSearchImage(providerName, url, CancellationToken.None).ConfigureAwait(false);
|
|
|
|
var result = await _providerManager.GetSearchImage(providerName, url, CancellationToken.None).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
|
|
var ext = result.ContentType.Split('/').Last();
|
|
|
|
var ext = result.ContentType.Split('/')[^1];
|
|
|
|
|
|
|
|
|
|
|
|
var fullCachePath = GetFullCachePath(urlHash + "." + ext);
|
|
|
|
var fullCachePath = GetFullCachePath(urlHash + "." + ext);
|
|
|
|
|
|
|
|
|
|
|
|
Directory.CreateDirectory(Path.GetDirectoryName(fullCachePath));
|
|
|
|
Directory.CreateDirectory(Path.GetDirectoryName(fullCachePath));
|
|
|
|
using (var stream = result.Content)
|
|
|
|
var stream = result.Content;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await using (stream.ConfigureAwait(false))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
using var fileStream = new FileStream(
|
|
|
|
var fileStream = new FileStream(
|
|
|
|
fullCachePath,
|
|
|
|
fullCachePath,
|
|
|
|
FileMode.Create,
|
|
|
|
FileMode.Create,
|
|
|
|
FileAccess.Write,
|
|
|
|
FileAccess.Write,
|
|
|
|
FileShare.Read,
|
|
|
|
FileShare.Read,
|
|
|
|
IODefaults.FileStreamBufferSize,
|
|
|
|
IODefaults.FileStreamBufferSize,
|
|
|
|
true);
|
|
|
|
true);
|
|
|
|
|
|
|
|
await using (fileStream.ConfigureAwait(false))
|
|
|
|
await stream.CopyToAsync(fileStream).ConfigureAwait(false);
|
|
|
|
{
|
|
|
|
|
|
|
|
await stream.CopyToAsync(fileStream).ConfigureAwait(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Directory.CreateDirectory(Path.GetDirectoryName(pointerCachePath));
|
|
|
|
Directory.CreateDirectory(Path.GetDirectoryName(pointerCachePath));
|
|
|
|