From 2c00ecb92316659717e64fab8a158536b86716e1 Mon Sep 17 00:00:00 2001 From: Dag Date: Sat, 26 Mar 2022 00:03:38 +0100 Subject: [PATCH] [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 --- bridges/Arte7Bridge.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/bridges/Arte7Bridge.php b/bridges/Arte7Bridge.php index fb2aa930..8baa4e6f 100644 --- a/bridges/Arte7Bridge.php +++ b/bridges/Arte7Bridge.php @@ -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'] . '

' - . $item['duration'] + . $durationMinutes . 'min