From 16a3fdb56e3f07185e75d106216f29519ccb25f7 Mon Sep 17 00:00:00 2001 From: Yassine Doghri Date: Sat, 29 Jul 2023 08:27:06 +0000 Subject: [PATCH] fix(rss): set srt transcripts' mimetype to application/x-subrip with rel="captions" attribute closes #360 --- app/Config/Mimes.php | 2 +- app/Helpers/rss_helper.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Config/Mimes.php b/app/Config/Mimes.php index cb944c17..433c932f 100644 --- a/app/Config/Mimes.php +++ b/app/Config/Mimes.php @@ -276,7 +276,7 @@ class Mimes ], 'svg' => ['image/svg+xml', 'image/svg', 'application/xml', 'text/xml'], 'vcf' => 'text/x-vcard', - 'srt' => ['text/srt', 'text/plain', 'application/octet-stream'], + 'srt' => ['application/x-subrip', 'text/srt', 'text/plain', 'application/octet-stream'], 'vtt' => ['text/vtt', 'text/plain'], 'ico' => ['image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'], 'stl' => ['application/sla', 'application/vnd.ms-pki.stl', 'application/x-navistyle'], diff --git a/app/Helpers/rss_helper.php b/app/Helpers/rss_helper.php index d3ee71aa..a20f71a6 100644 --- a/app/Helpers/rss_helper.php +++ b/app/Helpers/rss_helper.php @@ -360,6 +360,9 @@ if (! function_exists('get_rss_feed')) { pathinfo($episode->transcript->file_url, PATHINFO_EXTENSION) ) ?? 'text/html', ); + // Castopod only allows for captions (SubRip files) + $transcriptElement->addAttribute('rel', 'captions'); + // TODO: allow for multiple languages $transcriptElement->addAttribute('language', $podcast->language_code); }