mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-03-14 20:21:14 +03:00
[Arte7Bridge] feat: add duration filter #662
The feed item was given a "duration" key but that's not used for anything. refs https://github.com/RSS-Bridge/rss-bridge/issues/662
This commit is contained in:
parent
02ba3adcc9
commit
2c00ecb923
1 changed files with 15 additions and 2 deletions
|
@ -10,6 +10,14 @@ class Arte7Bridge extends BridgeAbstract {
|
|||
const API_TOKEN = 'Nzc1Yjc1ZjJkYjk1NWFhN2I2MWEwMmRlMzAzNjI5NmU3NWU3ODg4ODJjOWMxNTMxYzEzZGRjYjg2ZGE4MmIwOA';
|
||||
|
||||
const PARAMETERS = array(
|
||||
'global' => [
|
||||
'video_duration_filter' => [
|
||||
'name' => 'Exclude short videos',
|
||||
'type' => 'checkbox',
|
||||
'title' => 'Exclude videos that are shorter than 3 minutes',
|
||||
'defaultValue' => '',
|
||||
],
|
||||
],
|
||||
'Catégorie (Français)' => array(
|
||||
'catfr' => array(
|
||||
'type' => 'list',
|
||||
|
@ -97,6 +105,11 @@ class Arte7Bridge extends BridgeAbstract {
|
|||
$input_json = json_decode($input, true);
|
||||
|
||||
foreach($input_json['videos'] as $element) {
|
||||
$durationSeconds = $element['durationSeconds'];
|
||||
|
||||
if ($this->getInput('video_duration_filter') && $durationSeconds < 60 * 3) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$item = array();
|
||||
$item['uri'] = $element['url'];
|
||||
|
@ -108,10 +121,10 @@ class Arte7Bridge extends BridgeAbstract {
|
|||
if(!empty($element['subtitle']))
|
||||
$item['title'] = $element['title'] . ' | ' . $element['subtitle'];
|
||||
|
||||
$item['duration'] = round((int)$element['durationSeconds'] / 60);
|
||||
$durationMinutes = round((int)$durationSeconds / 60);
|
||||
$item['content'] = $element['teaserText']
|
||||
. '<br><br>'
|
||||
. $item['duration']
|
||||
. $durationMinutes
|
||||
. 'min<br><a href="'
|
||||
. $item['uri']
|
||||
. '"><img src="'
|
||||
|
|
Loading…
Add table
Reference in a new issue