fix: Port upstream cover extraction fallback and outline improvements
Port PR #838 (epub cover fallback logic) and PR #907 (cover outlines): - Add fallback cover filename probing when EPUB metadata lacks cover info - Case-insensitive extension checking for cover images - Detect and re-generate corrupt/empty thumbnail BMPs - Always draw outline rect on cover tiles for legibility (PR #907) - Upgrade Storage.exists() checks to Epub::isValidThumbnailBmp() - Fallback chain: Real Cover → PlaceholderCoverGenerator → X-pattern marker - Add epub.load retry logic (cache-only first, then full build) - Adapt upstream Serial.printf calls to LOG_DBG/LOG_ERR macros Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -642,11 +642,14 @@ void SleepActivity::renderCoverSleepScreen() const {
|
||||
|
||||
if (!lastEpub.generateCoverBmp(cropped)) {
|
||||
LOG_DBG("SLP", "EPUB cover generation failed, trying placeholder");
|
||||
PlaceholderCoverGenerator::generate(lastEpub.getCoverBmpPath(cropped), lastEpub.getTitle(),
|
||||
lastEpub.getAuthor(), 480, 800);
|
||||
if (!PlaceholderCoverGenerator::generate(lastEpub.getCoverBmpPath(cropped), lastEpub.getTitle(),
|
||||
lastEpub.getAuthor(), 480, 800)) {
|
||||
LOG_DBG("SLP", "Placeholder generation failed, creating X-pattern marker");
|
||||
lastEpub.generateInvalidFormatCoverBmp(cropped);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Storage.exists(lastEpub.getCoverBmpPath(cropped).c_str())) {
|
||||
if (!Epub::isValidThumbnailBmp(lastEpub.getCoverBmpPath(cropped))) {
|
||||
LOG_ERR("SLP", "Failed to generate cover bmp");
|
||||
return (this->*renderNoCoverSleepScreen)();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user