Skip to content

Commit

Permalink
Fix cover extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioMendolia committed Sep 20, 2023
1 parent deb5a8e commit 46888a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Service/BookFileSystemManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,19 @@ public function extractCover(Book $book): Book
case 'cbr':
case 'cbz':
$archive = new Archive7z($bookFile->getRealPath());

if(!$archive->isValid()) {
break;
}

$entries = [];
foreach ($archive->getEntries() as $entry) {
if (str_contains($entry->getPath(), '.jpg') || str_contains($entry->getPath(), '.jpeg')) {
$entries[] = $entry->getPath();
}
}
ksort($entries);

sort($entries);
if (count($entries) === 0) {
break;
}
Expand Down

0 comments on commit 46888a2

Please sign in to comment.