diff --git a/composer.json b/composer.json index 2b9057d..ca54697 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/src/Tools/MetaTitle.php b/src/Tools/MetaTitle.php index 83dda36..3ff5571 100644 --- a/src/Tools/MetaTitle.php +++ b/src/Tools/MetaTitle.php @@ -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}"; @@ -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}"; diff --git a/tests/MetaTitleTest.php b/tests/MetaTitleTest.php index cebc50a..6a6e663 100644 --- a/tests/MetaTitleTest.php +++ b/tests/MetaTitleTest.php @@ -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'); });