From 82b5daa809f97dd2e5890c0d5859d32572677d24 Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Mon, 9 May 2022 23:22:21 -0600 Subject: [PATCH] Download large cover art after successfilly downloading an audiobook. --- .../ProcessorAutomationController.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Source/LibationWinForms/BookLiberation/ProcessorAutomationController.cs b/Source/LibationWinForms/BookLiberation/ProcessorAutomationController.cs index 064b012e..a9f751aa 100644 --- a/Source/LibationWinForms/BookLiberation/ProcessorAutomationController.cs +++ b/Source/LibationWinForms/BookLiberation/ProcessorAutomationController.cs @@ -201,7 +201,23 @@ namespace LibationWinForms.BookLiberation var statusHandler = await Processable.ProcessSingleAsync(libraryBook, validate); 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; + } foreach (var errorMessage in statusHandler.Errors) LogMe.Error(errorMessage);