Skip to content

Commit

Permalink
fix: umlauts in chapters
Browse files Browse the repository at this point in the history
Fixes displaying umlauts in chapters when using the podlove player #71
  • Loading branch information
mauricerenck committed Mar 30, 2024
1 parent 550e952 commit c4ac1f3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
21 changes: 13 additions & 8 deletions app/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace mauricerenck\Podcaster;

use Kirby\Toolkit\Xml;
use Kirby\Toolkit\Str;

class Feed extends Podcast
{
Expand Down Expand Up @@ -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(),
];
Expand All @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion tests/PodcastTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public function testPodloveEpisodeJson()
],
[
'start' => '00:20:00.000',
'title' => 'Second Chapter',
'title' => 'Second Chapter with ä ö ü ß',
'href' => 'https://chapter.tld',
'image' => '',
],
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php return array(
'root' => 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__ . '/../../',
Expand Down Expand Up @@ -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__ . '/../../',
Expand Down

0 comments on commit c4ac1f3

Please sign in to comment.