From c4ac1f3727e19de4de48071a906ae8ec6788ed07 Mon Sep 17 00:00:00 2001 From: Maurice Renck Date: Sat, 30 Mar 2024 17:34:29 +0100 Subject: [PATCH] fix: umlauts in chapters Fixes displaying umlauts in chapters when using the podlove player #71 --- app/Feed.php | 21 +++++++++++++-------- tests/PodcastTest.php | 2 +- vendor/composer/installed.php | 8 ++++---- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/app/Feed.php b/app/Feed.php index 3dda0a5..021b226 100644 --- a/app/Feed.php +++ b/app/Feed.php @@ -3,6 +3,7 @@ namespace mauricerenck\Podcaster; use Kirby\Toolkit\Xml; +use Kirby\Toolkit\Str; class Feed extends Podcast { @@ -67,10 +68,12 @@ public function getAudioDuration($audio) public function getAudioEnclosures($episode, $audio): array { return [ - 'url' => $episode->url() . '/' . option( - 'mauricerenck.podcaster.downloadTriggerPath', - 'download' - ) . '/' . $audio->filename(), + 'url' => + $episode->url() . + '/' . + option('mauricerenck.podcaster.downloadTriggerPath', 'download') . + '/' . + $audio->filename(), 'length' => $audio->size(), 'type' => $audio->mime(), ]; @@ -94,13 +97,15 @@ public function getChapters($episode, $returnEmptyFields = false, $milliseconds $chapterList = []; foreach ($episode->podcasterChapters()->toStructure() as $chapter) { - $chapterStart = ($milliseconds) ? $chapter->podcasterChapterTimestamp()->value() . '.000' : $chapter->podcasterChapterTimestamp()->value(); + $chapterStart = $milliseconds + ? $chapter->podcasterChapterTimestamp()->value() . '.000' + : $chapter->podcasterChapterTimestamp()->value(); $newChapter = [ 'start' => $chapterStart, - 'title' => Xml::encode($chapter->podcasterChapterTitle()), - 'href' => ($returnEmptyFields) ? '' : null, - 'image' => ($returnEmptyFields) ? '' : null, + 'title' => Str::esc($chapter->podcasterChapterTitle()), + 'href' => $returnEmptyFields ? '' : null, + 'image' => $returnEmptyFields ? '' : null, ]; if ($chapter->podcasterChapterUrl()->isNotEmpty()) { diff --git a/tests/PodcastTest.php b/tests/PodcastTest.php index f5a50ed..96e71ca 100644 --- a/tests/PodcastTest.php +++ b/tests/PodcastTest.php @@ -246,7 +246,7 @@ public function testPodloveEpisodeJson() ], [ 'start' => '00:20:00.000', - 'title' => 'Second Chapter', + 'title' => 'Second Chapter with ä ö ü ß', 'href' => 'https://chapter.tld', 'image' => '', ], diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index ceb4ba7..872c2c7 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,8 +1,8 @@ array( 'name' => 'mauricerenck/podcaster', - 'pretty_version' => '3.2.1', - 'version' => '3.2.1.0', + 'pretty_version' => '3.2.3', + 'version' => '3.2.3.0', 'reference' => NULL, 'type' => 'kirby-plugin', 'install_path' => __DIR__ . '/../../', @@ -38,8 +38,8 @@ 'dev_requirement' => false, ), 'mauricerenck/podcaster' => array( - 'pretty_version' => '3.2.1', - 'version' => '3.2.1.0', + 'pretty_version' => '3.2.3', + 'version' => '3.2.3.0', 'reference' => NULL, 'type' => 'kirby-plugin', 'install_path' => __DIR__ . '/../../',