|
|
|
@ -124,6 +124,8 @@ namespace MediaBrowser.Providers.Manager
|
|
|
|
|
var retryPaths = GetSavePaths(item, type, imageIndex, mimeType, false);
|
|
|
|
|
|
|
|
|
|
// If there are more than one output paths, the stream will need to be seekable
|
|
|
|
|
if (paths.Length > 1 && !source.CanSeek)
|
|
|
|
|
{
|
|
|
|
|
var memoryStream = new MemoryStream();
|
|
|
|
|
await using (source.ConfigureAwait(false))
|
|
|
|
|
{
|
|
|
|
@ -131,6 +133,7 @@ namespace MediaBrowser.Providers.Manager
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
source = memoryStream;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var currentImage = GetCurrentImage(item, type, index);
|
|
|
|
|
var currentImageIsLocalFile = currentImage != null && currentImage.IsLocalFile;
|
|
|
|
@ -140,20 +143,21 @@ namespace MediaBrowser.Providers.Manager
|
|
|
|
|
|
|
|
|
|
await using (source.ConfigureAwait(false))
|
|
|
|
|
{
|
|
|
|
|
var currentPathIndex = 0;
|
|
|
|
|
|
|
|
|
|
foreach (var path in paths)
|
|
|
|
|
for (int i = 0; i < paths.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (i != 0)
|
|
|
|
|
{
|
|
|
|
|
source.Position = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string retryPath = null;
|
|
|
|
|
if (paths.Length == retryPaths.Length)
|
|
|
|
|
{
|
|
|
|
|
retryPath = retryPaths[currentPathIndex];
|
|
|
|
|
retryPath = retryPaths[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var savedPath = await SaveImageToLocation(source, path, retryPath, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
var savedPath = await SaveImageToLocation(source, paths[i], retryPath, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
savedPaths.Add(savedPath);
|
|
|
|
|
currentPathIndex++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -224,7 +228,6 @@ namespace MediaBrowser.Providers.Manager
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
source.Position = 0;
|
|
|
|
|
await SaveImageToLocation(source, retryPath, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
return retryPath;
|
|
|
|
|
}
|
|
|
|
@ -253,7 +256,7 @@ namespace MediaBrowser.Providers.Manager
|
|
|
|
|
|
|
|
|
|
await using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, FileOptions.Asynchronous))
|
|
|
|
|
{
|
|
|
|
|
await source.CopyToAsync(fs, IODefaults.CopyToBufferSize, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
await source.CopyToAsync(fs, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_config.Configuration.SaveMetadataHidden)
|
|
|
|
|