From ee52a08f78620b4f4bc690e6f75bccaade652459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ewilan=20Rivi=C3=A8re?= Date: Sun, 4 Feb 2024 12:43:48 +0100 Subject: [PATCH 1/4] Add new methods to retrieve podcast description and language --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 49a5866..2951778 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,8 @@ $audio->getCreationDate(); // `?string` to get creation date (audiobook) $audio->getCopyright(); // `?string` to get copyright (audiobook) $audio->getEncoding(); // `?string` to get encoding $audio->getDescription(); // `?string` to get description (audiobook) +$audio->getPodcastDescription(); // `?string` to get podcast description (audiobook) +$audio->getLanguage(); // `?string` to get language $audio->getLyrics(); // `?string` (audiobook) $audio->getStik(); // `?string` (audiobook) $audio->getDuration(); // `?float` to get duration in seconds From a67a563d214140d44da8c10ec0994f5c2202617c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ewilan=20Rivi=C3=A8re?= Date: Mon, 5 Feb 2024 08:44:47 +0100 Subject: [PATCH 2/4] Add podcastDescription() and language() methods to Id3Writer class --- src/Models/Id3Writer.php | 14 ++++++++++++++ tests/WriterTest.php | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/src/Models/Id3Writer.php b/src/Models/Id3Writer.php index e0882b9..5e56a82 100644 --- a/src/Models/Id3Writer.php +++ b/src/Models/Id3Writer.php @@ -201,6 +201,20 @@ public function description(?string $description): self return $this; } + public function podcastDescription(?string $podcastDescription): self + { + $this->core->setPodcastDescription($podcastDescription); + + return $this; + } + + public function language(?string $language): self + { + $this->core->setLanguage($language); + + return $this; + } + public function lyrics(?string $lyrics): self { $this->core->setLyrics($lyrics); diff --git a/tests/WriterTest.php b/tests/WriterTest.php index 4005019..a1c3c60 100644 --- a/tests/WriterTest.php +++ b/tests/WriterTest.php @@ -275,6 +275,15 @@ expect($tag->getCore()->getCover()->data())->toBe(base64_encode($content)); })->with([MP3_WRITER]); +// it('can change podcast description and language', function () { +// $audio = Audio::get(AUDIOBOOK); +// $tag = $audio->update() +// ->title('New Title') +// ->podcastDescription('New Podcast Description') +// ->language('New Language') +// ->save(); +// }); + // it('can not override tags', function (string $path) { // $audio = Audio::get($path); From a50e4736f894f2baa55c8858711fc0fd9cbf92e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ewilan=20Rivi=C3=A8re?= Date: Tue, 4 Jun 2024 07:28:48 +0200 Subject: [PATCH 3/4] v3.0.07 By @panVag * use `DateTimeImmutable` super powers to parse date and datetime strings * catch and ignore exception when instantiating the aforementioned object so the whole script won't fail * remove the null safe operators when it's not needed --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7d41efa..20ace07 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "kiwilan/php-audio", "description": "PHP package to parse and update audio files metadata, with `JamesHeinrich/getID3`.", - "version": "3.0.06", + "version": "3.0.07", "keywords": [ "audio", "php", From 2223c55e6c2454d8aedb8618a3c215be560a9c7c Mon Sep 17 00:00:00 2001 From: ewilan-riviere Date: Tue, 4 Jun 2024 05:29:13 +0000 Subject: [PATCH 4/4] Fix styling --- src/Models/AudioCore.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Models/AudioCore.php b/src/Models/AudioCore.php index 4465699..3b833a5 100644 --- a/src/Models/AudioCore.php +++ b/src/Models/AudioCore.php @@ -545,7 +545,7 @@ public static function fromQuicktime(Id3TagQuicktime $tag): AudioCore // ignore the issue so the rest of the data will be available } - if (!empty($parsedCreationDate)) { + if (! empty($parsedCreationDate)) { $core->setCreationDate($parsedCreationDate->format('Y-m-d\TH:i:s\Z')); $core->setYear((int) $parsedCreationDate->format('Y')); }