Download large cover art after successfilly downloading an audiobook.

This commit is contained in:
Michael Bucari-Tovo 2022-05-09 23:22:21 -06:00
parent b320276926
commit 82b5daa809

View File

@ -201,7 +201,23 @@ namespace LibationWinForms.BookLiberation
var statusHandler = await Processable.ProcessSingleAsync(libraryBook, validate); var statusHandler = await Processable.ProcessSingleAsync(libraryBook, validate);
if (statusHandler.IsSuccess) if (statusHandler.IsSuccess)
{
var destinationDir = AudibleFileStorage.Audio.GetDestinationDirectory(libraryBook);
var coverPath = FileManager.FileUtility.GetValidFilename(System.IO.Path.Combine(destinationDir, "Cover.jpg"), "", true);
try
{
var picBytes = PictureStorage.GetPictureSynchronously(new PictureDefinition(libraryBook.Book.PictureId_1215, PictureSize._1215x1215));
System.IO.File.WriteAllBytes(coverPath, picBytes);
}
catch(Exception ex)
{
LogMe.Error(ex.Message);
}
//Failure to download cover art should not be
//considered a failure to download the book
return true; return true;
}
foreach (var errorMessage in statusHandler.Errors) foreach (var errorMessage in statusHandler.Errors)
LogMe.Error(errorMessage); LogMe.Error(errorMessage);