Skip to content

Commit

Permalink
v2.6.9
Browse files Browse the repository at this point in the history
Add `duration_human_readable` for `getExtras()` method for audiobooks.

Works with `kiwilan/php-audio` v3.0.08.
  • Loading branch information
ewilan-riviere committed Jul 28, 2024
1 parent 2cb0f54 commit a01a8c4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 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.8",
"version": "2.6.9",
"keywords": [
"php",
"ebook",
Expand Down Expand Up @@ -43,7 +43,7 @@
"kiwilan/php-xml-reader": "^1.0.11"
},
"require-dev": {
"kiwilan/php-audio": "^3.0.06",
"kiwilan/php-audio": "^3.0.08",
"laravel/pint": "^1.7",
"pestphp/pest": "^1.20",
"pestphp/pest-plugin-parallel": "^1.2",
Expand Down
2 changes: 2 additions & 0 deletions src/Formats/Audio/AudiobookModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ private function create(): self
'copyright' => $this->parseTag($audio->getTag('copyright')),
'stik' => $audio->getStik(),
'duration' => $audio->getDuration(),
'duration_human_readable' => $audio->getDurationHumanReadable(),
'audio_title' => $audio->getTitle(),
'audio_artist' => $audio->getArtist(),
'audio_album' => $audio->getAlbum(),
Expand Down Expand Up @@ -152,6 +153,7 @@ public function toEbook(): Ebook
'disc_number' => $this->getAudioValue('disc_number'),
'stik' => $this->getAudioValue('stik'),
'duration' => $this->getAudioValue('duration'),
'duration_human_readable' => $this->getAudioValue('duration_human_readable'),
'audio_title' => $this->getAudioValue('audio_title'),
'audio_artist' => $this->getAudioValue('audio_artist'),
'audio_album' => $this->getAudioValue('audio_album'),
Expand Down
9 changes: 9 additions & 0 deletions tests/AudiobookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,12 @@

expect($ebook->getTags())->toBeEmpty();
});

it('can parse audiobook emma', function () {
$ebook = Ebook::read(AUDIOBOOK_EWILAN);
$duration = $ebook->getExtra('duration');
$duration_human_readable = $ebook->getExtra('duration_human_readable');

expect($duration)->toBe(33.0);
expect($duration_human_readable)->toBe('00:00:33');
});

0 comments on commit a01a8c4

Please sign in to comment.