Programma podcast RSS

This commit is contained in:
2021-08-18 19:47:21 +02:00
parent bf11bf9815
commit f1ae89b596
3 changed files with 26 additions and 4 deletions

View File

@@ -53,6 +53,27 @@ QUERY;
return response($view)->header('Content-Type', 'application/xml'); return response($view)->header('Content-Type', 'application/xml');
} }
/**
* RSS-feed van alle podcasts van een programma (bv. podcastserie)
*/
public function program_rss(Request $request, $program) {
$page = (int)$request->get('page', 1);
if($page <= 0) {
return abort(400);
}
$programQuery = app('db')->select('SELECT `programs`.`id` AS `id`, `programs`.`longname` AS `name`, `programs`.`description` AS `description`, `programs`.`tagline` AS `tagline`, `programs`.`description` AS `description`, `programs`.`email` FROM `programs` WHERE `programs`.`id` = :id', ['id' => $program]);
$programDetails = new \Model\Program($programQuery[0]);
$filter = '`podcast_meta`.`program` = :program';
$params = ['program' => (int)$program];
$podcasts = $this->retrievePodcasts($page, $count = 1000, $filter, $params);
$view = view('rss.podcasts')->with('program', $programDetails)->with('podcasts', $podcasts)->with('url', $request->url())->with('page', $page);
return response($view)->header('Content-Type', 'application/xml');
}
/**
* Lijst van alle podcasts voor een specifiek programma
/** /**
* Lijst van alle podcasts voor een specifiek programma * Lijst van alle podcasts voor een specifiek programma
*/ */

View File

@@ -5,9 +5,9 @@
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"> xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
<channel> <channel>
<title>NH Gooi Gemist</title> <title>{{isset($program) ? $program->name : "NH Gooi Gemist"}}</title>
<description>Fragmenten en interviews eerder te horen op NH Gooi Radio</description> <description>{{isset($program) ? $program->description : "Fragmenten en interviews eerder te horen op NH Gooi Radio"}}</description>
<link>https://nhgooi.nl</link> <link>https://nhgooi.nl{{isset($program) ? $program->url : ""}}</link>
<language>nl-nl</language> <language>nl-nl</language>
<atom:link rel="self" href="{{$url}}?page={{$page}}"/> <atom:link rel="self" href="{{$url}}?page={{$page}}"/>
@@ -22,7 +22,7 @@
<itunes:image href="https://nhgooi.nl/images/logo.png" /> <itunes:image href="https://nhgooi.nl/images/logo.png" />
<itunes:owner> <itunes:owner>
<itunes:name>NH Gooi Radio</itunes:name> <itunes:name>NH Gooi Radio</itunes:name>
<itunes:email>info@nhgooi.nl</itunes:email> <itunes:email>{{isset($program) ? $program->email : 'info' }}@nhgooi.nl</itunes:email>
</itunes:owner> </itunes:owner>
<itunes:category text="News"> <itunes:category text="News">
<itunes:category text="Politics" /> <itunes:category text="Politics" />

View File

@@ -17,6 +17,7 @@ $app->get('/', function () use ($app) {
}); });
$app->get( 'rss/podcasts', 'PodcastController@rss' ); $app->get( 'rss/podcasts', 'PodcastController@rss' );
$app->get( 'rss/podcast/{program:\d+}/{title}', 'PodcastController@program_rss' );
$app->get( 'rss/nieuws', 'NewsController@rss' ); $app->get( 'rss/nieuws', 'NewsController@rss' );
$app->get( 'menu/special', 'MenuController@special' ); $app->get( 'menu/special', 'MenuController@special' );