From e28e8453b9133a688078ea14bf4adefdecb6a779 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Wed, 19 Apr 2023 12:06:36 -0500 Subject: [PATCH] Add Kindle thumbnails to AZW3 bulk downloads --- scripts/generate-bulk-downloads | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/generate-bulk-downloads b/scripts/generate-bulk-downloads index 1da64233..e18ab46b 100755 --- a/scripts/generate-bulk-downloads +++ b/scripts/generate-bulk-downloads @@ -49,7 +49,13 @@ function CreateZip(string $filePath, array $ebooks, string $type, string $webRoo if($type == 'azw3' && $ebook->Azw3Url !== null){ $ebookFilePath = $webRoot . '/' . $ebook->Azw3Url; - $zip->addFile($ebookFilePath, basename($ebookFilePath)); + $folderName = basename($ebookFilePath, '.azw3'); + $zip->addFile($ebookFilePath, $folderName . '/' . basename($ebookFilePath)); + + if($ebook->KindleCoverUrl !== null){ + $ebookThumbnailPath = $webRoot . '/' . $ebook->KindleCoverUrl; + $zip->addFile($ebookFilePath, $folderName . '/' . basename($ebookThumbnailPath)); + } } if($type == 'kepub' && $ebook->KepubUrl !== null){