Skip to content

Commit

Permalink
Merge pull request #93 from kiwilan/develop
Browse files Browse the repository at this point in the history
v2.6.7
  • Loading branch information
ewilan-riviere authored Jul 16, 2024
2 parents 9dc8bb1 + 654a81b commit 4a03fd1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kiwilan/php-ebook",
"description": "PHP package to read metadata and extract covers from eBooks, comics and audiobooks.",
"version": "2.6.6",
"version": "2.6.7",
"keywords": [
"php",
"ebook",
Expand Down
7 changes: 6 additions & 1 deletion src/Formats/Cba/CbaModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ private function parseCbam(): Ebook
$this->ebook->setTags($this->cbam->getGenres());
$this->ebook->setSeries($this->cbam->getSeries());
$this->ebook->setVolume($this->cbam->getNumber());
$this->ebook->setPagesCount($this->cbam->getPageCount());

$count = $this->cbam->getPageCount();
if (! $count) {
$count = $this->ebook->getArchive()->getCount();
}
$this->ebook->setPagesCount($count);

$comicMeta = new ComicMeta(
alternateSeries: $this->cbam->getAlternateSeries(),
Expand Down
11 changes: 11 additions & 0 deletions tests/CbaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,14 @@

expect($cba->getNumber())->toBe(0);
});

it('can parse comics pages', function (string $path) {
$ebook = Ebook::read($path);

expect($ebook->getPagesCount())->toBeInt();
})->with([
CBZ_CBAM,
CBZ_CRM,
CBZ_CBAM_VOLUME,
CBZ_CBAM_NO_PAGES,
]);
1 change: 1 addition & 0 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
define('CBZ_CBML', __DIR__.'/media/cba-cbml.cbz');
define('CBZ_CRM', __DIR__.'/media/cba-crm.cbz');
define('CBZ_CBAM_VOLUME', __DIR__.'/media/cba-cbam-volume.cbz');
define('CBZ_CBAM_NO_PAGES', __DIR__.'/media/cba-cbam-no-pages.cbz');

define('COMIC_INFO_BASIC', __DIR__.'/media/ComicInfoBasic.xml');
define('COMIC_INFO_SERIES_WITHOUT_VOLUME', __DIR__.'/media/ComicInfoSeriesWithoutVolume.xml');
Expand Down
Binary file added tests/media/cba-cbam-no-pages.cbz
Binary file not shown.

0 comments on commit 4a03fd1

Please sign in to comment.