Commit 80fdd9cf authored by Dwev's avatar Dwev Committed by Yassine Doghri
Browse files

feat: add trailer tags to rss if trailer episodes are present

parent 004f8040
Loading
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -348,6 +348,21 @@ if (! function_exists('get_rss_feed')) {
                $item->addChild('season', (string) $episode->season_number, $itunesNamespace);
            $item->addChild('episodeType', $episode->type, $itunesNamespace);

            // If episode is of type trailer, add podcast:trailer tag on channel level
            if ($episode->type == 'trailer') {
                $trailer = $channel->addChild('trailer', $episode->title, $podcastNamespace);
                $trailer->addAttribute('pubdate', $episode->published_at->format(DATE_RFC2822));
                $trailer->addAttribute(
                    'url',
                    $episode->audio_url . ($enclosureParams === '' ? '' : '?' . $enclosureParams),
                );
                $trailer->addAttribute('length', (string) $episode->audio->file_size);
                $trailer->addAttribute('type', $episode->audio->file_mimetype);
                if ($episode->season_number !== null) {
                    $trailer->addAttribute('season', (string) $episode->season_number);
                }
            }

            // add podcast namespace tags for season and episode
            $episode->season_number &&
                $item->addChild('season', (string) $episode->season_number, $podcastNamespace);