Skip to content

Commit

Permalink
Merge pull request #22 from kiwilan/develop
Browse files Browse the repository at this point in the history
`MetaTitle` improve `uniqueFilename`
  • Loading branch information
ewilan-riviere authored Jun 22, 2023
2 parents 441269e + c531bfc commit b00a2a9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 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 (.epub, .cbz, .cbr, .cb7, .cbt, .pdf) and audiobooks (.mp3, .m4a, .m4b, .flac, .ogg).",
"version": "1.3.33",
"version": "1.3.34",
"keywords": [
"php",
"ebook",
Expand Down
8 changes: 4 additions & 4 deletions src/Tools/MetaTitle.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ private function generateSlug(string $title, ?string $type, ?string $language):
*/
private function generateUniqueFilename(Ebook $ebook): string
{
$author = $this->setSlug($ebook->authorMain());
$filename = "{$author}";
$language = $this->setSlug($ebook->language());
$filename = "{$language}";
if ($ebook->series()) {
$series = $this->setSlug($ebook->series());
$filename .= "-{$series}";
Expand All @@ -224,8 +224,8 @@ private function generateUniqueFilename(Ebook $ebook): string
}
$title = $this->setSlug($ebook->title());
$filename .= "-{$title}";
$language = $this->setSlug($ebook->language());
$filename .= "-{$language}";
$author = $this->setSlug($ebook->authorMain());
$filename .= "-{$author}";
$format = $this->setSlug($ebook->extension());
$filename .= "-{$format}";

Expand Down
2 changes: 1 addition & 1 deletion tests/MetaTitleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
expect($meta->serieSlugSort())->toBe('a-comme-association');
expect($meta->serieSlugLang())->toBe('a-comme-association-epub-fr');
expect($meta->slugSortWithSerie())->toBe('a-comme-association-01_pale-lumiere-des-tenebres');
expect($meta->uniqueFilename())->toBe('jean-m-auel-a-comme-association-01-la-pale-lumiere-des-tenebres-fr-epub');
expect($meta->uniqueFilename())->toBe('fr-a-comme-association-01-la-pale-lumiere-des-tenebres-jean-m-auel-epub');
});

0 comments on commit b00a2a9

Please sign in to comment.