Compare commits
13 Commits
2a7f5b7036
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
abc9914827 | ||
|
|
d859df0ab4 | ||
|
|
0c16562e87 | ||
|
|
b87b7bfa75 | ||
|
|
e817ac577c | ||
|
|
75e9fc79f3 | ||
| 089fbdec7f | |||
|
|
2c5b6b3ac6 | ||
|
|
08fd66ecba | ||
| d8d268667e | |||
|
|
dee127eebf | ||
|
|
e95a079593 | ||
| 4f940c1df0 |
8
api/.gitignore
vendored
8
api/.gitignore
vendored
@@ -1,5 +1,5 @@
|
|||||||
/vendor
|
syntax: glob
|
||||||
/.idea
|
|
||||||
Homestead.json
|
|
||||||
Homestead.yaml
|
|
||||||
.env
|
.env
|
||||||
|
api/storage
|
||||||
|
*.orig
|
||||||
|
|||||||
@@ -103,13 +103,19 @@ QUERY;
|
|||||||
|
|
||||||
public function retrieveNewsItems($page, $count, $filter, $params) {
|
public function retrieveNewsItems($page, $count, $filter, $params) {
|
||||||
$filterSql = "";
|
$filterSql = "";
|
||||||
$params = ['target' => self::$WEBSITE_TARGET, 'category' => self::$NEWS_CATEGORY, 'secondarycategory' => self::$EXTERNAL_NEWS_CATEGORY];
|
$params['target'] = self::$WEBSITE_TARGET;
|
||||||
if($filter) {
|
$params['category'] = self::$NEWS_CATEGORY;
|
||||||
foreach($filter as $field => $value) {
|
$params['secondarycategory'] = self::$EXTERNAL_NEWS_CATEGORY;
|
||||||
$paramName = preg_replace('/[^A-Za-z0-9]/', '', $field);
|
if($filter) {
|
||||||
$filterSql .= " AND $field = :$paramName";
|
if(is_array($filter)) {
|
||||||
$params[$paramName] = $value;
|
foreach($filter as $field => $value) {
|
||||||
}
|
$paramName = preg_replace('/[^A-Za-z0-9]/', '', $field);
|
||||||
|
$filterSql .= " AND $field = :$paramName";
|
||||||
|
$params[$paramName] = $value;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$filterSql .= ' AND ' . $filter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$start = ($page - 1) * $count;
|
$start = ($page - 1) * $count;
|
||||||
@@ -397,6 +403,70 @@ QUERY
|
|||||||
return $item ? response()->json(new \Model\CalendarEvent($item['data'], $item['images'], $item['podcast'])) : abort(404);
|
return $item ? response()->json(new \Model\CalendarEvent($item['data'], $item['images'], $item['podcast'])) : abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overzicht voor het NLPO-dashboard
|
||||||
|
*/
|
||||||
|
public function nlpo(Request $request) {
|
||||||
|
$from = $request->get('from');
|
||||||
|
if(!$from) { $from = date('Y-m-d', strtotime('-7 days')); }
|
||||||
|
$to = $request->get('to');
|
||||||
|
if(!$to) { $to = date('Y-m-d'); }
|
||||||
|
|
||||||
|
$filter = 'DATE(`news`.`creationdt`) >= :from AND DATE(`news`.`creationdt`) <= :to';
|
||||||
|
$items = $this->retrieveNewsItems(1, 10000,
|
||||||
|
$filter,
|
||||||
|
['from' => $from, 'to' => $to]);
|
||||||
|
$result = [];
|
||||||
|
foreach($items as $item) {
|
||||||
|
$tags = [];
|
||||||
|
if($item->theme) $tags[] = $item->theme->title;
|
||||||
|
if($item->region) $tags[] = $item->region->title;
|
||||||
|
|
||||||
|
$text = $item->content;
|
||||||
|
$source = app('db')->select('SELECT content FROM `news_target_content` WHERE news = :news AND target = 0 AND published = 1 AND active = 1',
|
||||||
|
['news' => $item->id]);
|
||||||
|
if(count($source)) {
|
||||||
|
$text = $source[0]->content;
|
||||||
|
$source_data = json_decode($source[0]->content);
|
||||||
|
if($source_data) {
|
||||||
|
$text = "";
|
||||||
|
foreach($source_data->article->blocks as $block) {
|
||||||
|
if($block->type == 'authors') {
|
||||||
|
$authors = [];
|
||||||
|
foreach($block->authors as $author) {
|
||||||
|
$authors[] = $author->name;
|
||||||
|
}
|
||||||
|
$item->author = implode(', ', $authors);
|
||||||
|
} else if(isset($block->text) && $block->type != 'info') {
|
||||||
|
$text .= strip_tags($block->text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$text = $source[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$result[] = [
|
||||||
|
'title' => $this->nlpo_convert_utf8($item->title),
|
||||||
|
'url' => 'https://nhgooi.nl/' . $item->url,
|
||||||
|
'text' => $this->nlpo_convert_utf8($text),
|
||||||
|
'date' => $item->published->format('Y-m-d\TH:i:s.z\Z'),
|
||||||
|
'art_id' => $item->id,
|
||||||
|
'author' => $item->author,
|
||||||
|
'excerpt' => $this->nlpo_convert_utf8(strip_tags($item->content)),
|
||||||
|
'categories' => $tags,
|
||||||
|
'tags' => $tags,
|
||||||
|
'comment_count' => 0
|
||||||
|
];
|
||||||
|
}
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
return json_encode($result, JSON_UNESCAPED_UNICODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function nlpo_convert_utf8($str) {
|
||||||
|
$str = html_entity_decode($str, ENT_QUOTES, 'UTF-8');
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
private function itemFromCategory($category, $id) {
|
private function itemFromCategory($category, $id) {
|
||||||
$params = ['id' => (int)$id, 'target' => self::$WEBSITE_TARGET];
|
$params = ['id' => (int)$id, 'target' => self::$WEBSITE_TARGET];
|
||||||
if(is_array($category)) {
|
if(is_array($category)) {
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ use Illuminate\Http\Request;
|
|||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
ini_set('display_errors', true);
|
|
||||||
|
|
||||||
class PodcastController extends Controller
|
class PodcastController extends Controller
|
||||||
{
|
{
|
||||||
public static $BASE_SQL = <<<QUERY
|
public static $BASE_SQL = <<<QUERY
|
||||||
|
|||||||
21
api/app/Http/Controllers/TvController.php
Normal file
21
api/app/Http/Controllers/TvController.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TvController extends Controller
|
||||||
|
{
|
||||||
|
public function ticker() {
|
||||||
|
$programController = new ProgramController();
|
||||||
|
$program = $programController->comingup();
|
||||||
|
|
||||||
|
$newsController = new NewsController();
|
||||||
|
$news = $newsController->retrieveNewsItems(1, 3, null, []);
|
||||||
|
|
||||||
|
return view('tv_ticker', [
|
||||||
|
'onair' => $program->getData(),
|
||||||
|
'news' => $news
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<?php header('Access-Control-Allow-Origin: *'); ?>
|
<?php header('Access-Control-Allow-Origin: *'); ?>
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?php header('Content-Type: text/xml'); ?>
|
||||||
|
<{{ '' /* avoid PHP parsing this as short open tag */ }}?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<rss version="2.0"
|
<rss version="2.0"
|
||||||
xmlns:atom="http://www.w3.org/2005/Atom"
|
xmlns:atom="http://www.w3.org/2005/Atom"
|
||||||
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?php header('Access-Control-Allow-Origin: *'); ?>
|
||||||
|
<?php header('Content-Type: text/xml'); ?>
|
||||||
|
<{{ '' /* avoid PHP parsing this as short open tag */ }}?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<rss version="2.0"
|
<rss version="2.0"
|
||||||
xmlns:atom="http://www.w3.org/2005/Atom"
|
xmlns:atom="http://www.w3.org/2005/Atom"
|
||||||
xmlns:spotify="http://www.spotify.com/ns/rss"
|
xmlns:spotify="http://www.spotify.com/ns/rss"
|
||||||
@@ -6,7 +8,7 @@
|
|||||||
|
|
||||||
<channel>
|
<channel>
|
||||||
<title>{{isset($program) ? $program->name : "NH Gooi Gemist"}}</title>
|
<title>{{isset($program) ? $program->name : "NH Gooi Gemist"}}</title>
|
||||||
<description>{{isset($program) ? $program->description : "Fragmenten en interviews eerder te horen op NH Gooi Radio"}}</description>
|
<description><![CDATA[{!! isset($program) ? html_entity_decode($program->description) : "Fragmenten en interviews eerder te horen op NH Gooi Radio" !!}]]></description>
|
||||||
<link>https://nhgooi.nl{{isset($program) ? $program->url : ""}}</link>
|
<link>https://nhgooi.nl{{isset($program) ? $program->url : ""}}</link>
|
||||||
<language>nl-nl</language>
|
<language>nl-nl</language>
|
||||||
|
|
||||||
@@ -19,7 +21,7 @@
|
|||||||
|
|
||||||
<itunes:author>NH Gooi Radio</itunes:author>
|
<itunes:author>NH Gooi Radio</itunes:author>
|
||||||
<itunes:explicit>no</itunes:explicit>
|
<itunes:explicit>no</itunes:explicit>
|
||||||
<itunes:image href="https://nhgooi.nl/images/logo_sqr_hq.png" />
|
<itunes:image href="https://nhgooi.nl/images/{{ isset($program) && $program->id == 1097 ? "hilversum_oorlog.jpg" : "logo_sqr_hq.png" }}" />
|
||||||
<itunes:owner>
|
<itunes:owner>
|
||||||
<itunes:name>NH Gooi Radio</itunes:name>
|
<itunes:name>NH Gooi Radio</itunes:name>
|
||||||
<itunes:email>{{isset($program) ? $program->email : 'info' }}@nhgooi.nl</itunes:email>
|
<itunes:email>{{isset($program) ? $program->email : 'info' }}@nhgooi.nl</itunes:email>
|
||||||
@@ -34,19 +36,21 @@
|
|||||||
<item>
|
<item>
|
||||||
<guid>https://nhgooi.nl/podcast-{{$podcast->id}}</guid>
|
<guid>https://nhgooi.nl/podcast-{{$podcast->id}}</guid>
|
||||||
<title>{{html_entity_decode($podcast->title)}}</title>
|
<title>{{html_entity_decode($podcast->title)}}</title>
|
||||||
<description>{{html_entity_decode($podcast->content)}}</description>
|
<description><![CDATA[{!! html_entity_decode($podcast->content) !!}]]></description>
|
||||||
<link>https://nhgooi.nl/gemist/fragment/{{$podcast->url}}</link>
|
<link>https://nhgooi.nl/gemist/fragment/{{$podcast->url}}</link>
|
||||||
<enclosure url="{{url('podcast/download' . $podcast->url . '?auth=' . $podcast->auth)}}" type="audio/mpeg" length="{{filesize($podcast->getSoundFile())}}"></enclosure>
|
<enclosure url="{{url('podcast/download' . $podcast->url . '?auth=' . $podcast->auth)}}" type="audio/mpeg" length="{{filesize($podcast->getSoundFile())}}"></enclosure>
|
||||||
<pubDate>{{$podcast->created->format('r')}}</pubDate>
|
<pubDate>{{$podcast->created->format('r')}}</pubDate>
|
||||||
|
|
||||||
<itunes:title>{{$podcast->title}}</itunes:title>
|
<itunes:title>{{$podcast->title}}</itunes:title>
|
||||||
<itunes:author>NH Gooi Radio</itunes:author>
|
<itunes:author>NH Gooi Radio</itunes:author>
|
||||||
<itunes:summary>{{$podcast->content}}</itunes:summary>
|
<itunes:summary><![CDATA[{!! html_entity_decode($podcast->content) !!}]]></itunes:summary>
|
||||||
<itunes:duration>{{$podcast->formatDuration()}}</itunes:duration>
|
<itunes:duration>{{$podcast->formatDuration()}}</itunes:duration>
|
||||||
<itunes:explicit>no</itunes:explicit>
|
<itunes:explicit>no</itunes:explicit>
|
||||||
@if($podcast->image)
|
@if($podcast->image)
|
||||||
<itunes:image href="https://nhgooi.nl{{$podcast->image->url}}"/>
|
<itunes:image href="https://nhgooi.nl{{$podcast->image->url}}"/>
|
||||||
@endif
|
@elseif($podcast->program && $podcast->program->image)
|
||||||
|
<itunes:image href="https://nhgooi.nl{{$podcast->program->image->url}}"/>
|
||||||
|
@endif
|
||||||
</item>
|
</item>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
|
|||||||
37
api/resources/views/tv_ticker.blade.php
Normal file
37
api/resources/views/tv_ticker.blade.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
NH Gooi 92.0 FM ***
|
||||||
|
|
||||||
|
@if($onair && $onair->schedule && count($onair->schedule))
|
||||||
|
<?
|
||||||
|
$current = $onair->schedule[0];
|
||||||
|
$ends = new \DateTimeImmutable($current->end->date, new \DateTimeZone($current->end->timezone));
|
||||||
|
?>
|
||||||
|
Met nu tot {{ $ends->format('H:i') }} uur:
|
||||||
|
{{ $current->program->name }}
|
||||||
|
@if($current->program->tagline
|
||||||
|
&& ($tagline = trim(html_entity_decode($current->program->tagline))))
|
||||||
|
– {{ $tagline }}
|
||||||
|
@endif
|
||||||
|
***
|
||||||
|
|
||||||
|
@if(count($onair->schedule) > 1)
|
||||||
|
<? $next = $onair->schedule[1]->program; ?>
|
||||||
|
Daarna: {{ $next->name }}
|
||||||
|
@if($current->program->tagline
|
||||||
|
&& ($tagline = trim(html_entity_decode($next->tagline))))
|
||||||
|
– {{ $tagline }}
|
||||||
|
@endif
|
||||||
|
***
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(count($news))
|
||||||
|
Laatste nieuws van nhgooi.nl:
|
||||||
|
@foreach($news as $item)
|
||||||
|
{{ $item->title }}
|
||||||
|
@if($item->video)
|
||||||
|
- bekijk de video op nhgooi.nl
|
||||||
|
@endif
|
||||||
|
***
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
Meer nieuws op nhgooi.nl ***
|
||||||
@@ -24,6 +24,7 @@ $app->get( 'menu/special', 'MenuController@special' );
|
|||||||
|
|
||||||
$app->get('nieuws/overzicht', 'NewsController@newslist' );
|
$app->get('nieuws/overzicht', 'NewsController@newslist' );
|
||||||
$app->get('nieuws/kabelkrant', 'NewsController@tvlist' );
|
$app->get('nieuws/kabelkrant', 'NewsController@tvlist' );
|
||||||
|
$app->get('nieuws/nlpo', 'NewsController@nlpo' );
|
||||||
$app->get('nieuws/regio/{region:[a-z0-9-]+}', 'NewsController@regionlist' );
|
$app->get('nieuws/regio/{region:[a-z0-9-]+}', 'NewsController@regionlist' );
|
||||||
$app->get('nieuws/thema/{theme:[a-z0-9-]+}', 'NewsController@themelist' );
|
$app->get('nieuws/thema/{theme:[a-z0-9-]+}', 'NewsController@themelist' );
|
||||||
$app->get('nieuws/zoeken/{query}', 'NewsController@findnews' );
|
$app->get('nieuws/zoeken/{query}', 'NewsController@findnews' );
|
||||||
@@ -63,6 +64,8 @@ $app->get('programma/details/{id:\d+}', 'ProgramController@details' );
|
|||||||
$app->get('programma/download/{year:20\d\d}/{month:\d\d?}/{day:\d\d?}/{hour:\d\d?}/{duration:\d\d?}', 'PodcastController@complete');
|
$app->get('programma/download/{year:20\d\d}/{month:\d\d?}/{day:\d\d?}/{hour:\d\d?}/{duration:\d\d?}', 'PodcastController@complete');
|
||||||
$app->get('programma/studiocam/onair', 'ProgramController@studiocam' );
|
$app->get('programma/studiocam/onair', 'ProgramController@studiocam' );
|
||||||
|
|
||||||
|
$app->get('/tv/ticker', 'TvController@ticker');
|
||||||
|
|
||||||
$app->get('kerkdienst', 'KerkdienstController@get');
|
$app->get('kerkdienst', 'KerkdienstController@get');
|
||||||
$app->get('kerkdienst/stream', 'KerkdienstController@podcast');
|
$app->get('kerkdienst/stream', 'KerkdienstController@podcast');
|
||||||
$app->get('kerkdienst/download', 'KerkdienstController@download');
|
$app->get('kerkdienst/download', 'KerkdienstController@download');
|
||||||
|
|||||||
Reference in New Issue
Block a user