mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 00:09:37 +02:00
Fixed: Don't try to create metadata images if source files doesn't exist
(cherry picked from commit 9a1022386a031c928fc0495d6ab990ebce605ec1) Closes #9189
This commit is contained in:
parent
97c2d4f9db
commit
24a17a9240
@ -297,6 +297,7 @@ private List<MetadataFile> ProcessMovieImages(IMetadata consumer, Movie movie, L
|
|||||||
private void DownloadImage(Movie movie, ImageFileResult image)
|
private void DownloadImage(Movie movie, ImageFileResult image)
|
||||||
{
|
{
|
||||||
var fullPath = Path.Combine(movie.Path, image.RelativePath);
|
var fullPath = Path.Combine(movie.Path, image.RelativePath);
|
||||||
|
var downloaded = true;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -304,13 +305,20 @@ private void DownloadImage(Movie movie, ImageFileResult image)
|
|||||||
{
|
{
|
||||||
_httpClient.DownloadFile(image.Url, fullPath);
|
_httpClient.DownloadFile(image.Url, fullPath);
|
||||||
}
|
}
|
||||||
else
|
else if (_diskProvider.FileExists(image.Url))
|
||||||
{
|
{
|
||||||
_diskProvider.CopyFile(image.Url, fullPath);
|
_diskProvider.CopyFile(image.Url, fullPath);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
downloaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (downloaded)
|
||||||
|
{
|
||||||
_mediaFileAttributeService.SetFilePermissions(fullPath);
|
_mediaFileAttributeService.SetFilePermissions(fullPath);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (HttpException ex)
|
catch (HttpException ex)
|
||||||
{
|
{
|
||||||
_logger.Warn(ex, "Couldn't download image {0} for {1}. {2}", image.Url, movie, ex.Message);
|
_logger.Warn(ex, "Couldn't download image {0} for {1}. {2}", image.Url, movie, ex.Message);
|
||||||
|
Loading…
Reference in New Issue
Block a user