2016-08-27 22:03:26 +03:00
|
|
|
<?php
|
|
|
|
class Arte7Bridge extends BridgeAbstract{
|
2014-05-26 02:30:46 +04:00
|
|
|
|
2016-08-27 22:03:26 +03:00
|
|
|
public $maintainer = "mitsukarenai";
|
|
|
|
public $name = "Arte +7";
|
|
|
|
public $uri = "http://www.arte.tv/";
|
|
|
|
public $description = "Returns newest videos from ARTE +7";
|
|
|
|
public $parameters = array(
|
|
|
|
'Catégorie (Français)' => array(
|
|
|
|
'catfr'=>array(
|
|
|
|
'type'=>'list',
|
|
|
|
'name'=>'Catégorie',
|
|
|
|
'values'=>array(
|
|
|
|
'Toutes les vidéos (français)'=>'toutes-les-videos',
|
|
|
|
'Actu & société'=>'actu-société',
|
|
|
|
'Séries & fiction'=>'séries-fiction',
|
|
|
|
'Cinéma'=>'cinéma',
|
|
|
|
'Arts & spectacles classiques'=>'arts-spectacles-classiques',
|
|
|
|
'Culture pop'=>'culture-pop',
|
|
|
|
'Découverte'=>'découverte',
|
|
|
|
'Histoire'=>'histoire',
|
|
|
|
'Junior'=>'junior'
|
2015-11-03 17:36:19 +03:00
|
|
|
|
2016-08-27 22:03:26 +03:00
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'Catégorie (Allemand)' => array(
|
|
|
|
'catde'=>array(
|
|
|
|
'type'=>'list',
|
|
|
|
'name'=>'Catégorie',
|
|
|
|
'values'=>array(
|
|
|
|
'Alle Videos (deutsch)'=>'alle-videos',
|
|
|
|
'Aktuelles & Gesellschaft'=>'aktuelles-gesellschaft',
|
|
|
|
'Fernsehfilme & Serien'=>'fernsehfilme-serien',
|
|
|
|
'Kino'=>'kino',
|
|
|
|
'Kunst & Kultur'=>'kunst-kultur',
|
|
|
|
'Popkultur & Alternativ'=>'popkultur-alternativ',
|
|
|
|
'Entdeckung'=>'entdeckung',
|
|
|
|
'Geschichte'=>'geschichte',
|
|
|
|
'Junior'=>'junior'
|
|
|
|
)
|
|
|
|
)
|
2016-08-22 02:25:56 +03:00
|
|
|
)
|
|
|
|
);
|
2015-11-03 17:36:19 +03:00
|
|
|
|
2016-08-25 00:40:47 +03:00
|
|
|
protected function extractVideoset($category='toutes-les-videos', $lang='fr'){
|
|
|
|
$url = 'http://www.arte.tv/guide/'.$lang.'/plus7/'.$category;
|
|
|
|
$input = $this->getContents($url) or die('Could not request ARTE.');
|
|
|
|
if(strpos($input, 'categoryVideoSet') !== FALSE){
|
2015-10-30 13:26:49 +03:00
|
|
|
$input = explode('categoryVideoSet: ', $input);
|
|
|
|
$input = explode('}},', $input[1]);
|
|
|
|
$input = $input[0].'}}';
|
2016-08-25 00:40:47 +03:00
|
|
|
}else{
|
2015-10-30 13:26:49 +03:00
|
|
|
$input = explode('videoSet: ', $input);
|
|
|
|
$input = explode('}]},', $input[1]);
|
|
|
|
$input = $input[0].'}]}';
|
2016-08-25 00:40:47 +03:00
|
|
|
}
|
|
|
|
$input = json_decode($input, TRUE);
|
|
|
|
return $input;
|
|
|
|
}
|
|
|
|
|
2016-08-25 02:24:53 +03:00
|
|
|
public function collectData(){
|
|
|
|
$param=$this->parameters[$this->queriedContext];
|
2014-05-26 02:30:46 +04:00
|
|
|
|
2015-10-31 15:26:56 +03:00
|
|
|
$category='toutes-les-videos'; $lang='fr';
|
2016-08-25 02:24:53 +03:00
|
|
|
if (!empty($param['catfr']['value']))
|
|
|
|
$category=$param['catfr']['value'];
|
|
|
|
if (!empty($param['catde']['value']))
|
|
|
|
{ $category=$param['catde']['value']; $lang='de'; }
|
2016-08-25 00:40:47 +03:00
|
|
|
$input_json = $this->extractVideoset($category, $lang);
|
2014-05-26 02:30:46 +04:00
|
|
|
|
2015-10-30 13:26:49 +03:00
|
|
|
foreach($input_json['videos'] as $element) {
|
2016-08-22 19:55:59 +03:00
|
|
|
$item = array();
|
|
|
|
$item['uri'] = str_replace("autoplay=1", "", $element['url']);
|
|
|
|
$item['id'] = $element['id'];
|
2015-10-30 13:26:49 +03:00
|
|
|
$hack_broadcast_time = $element['rights_end'];
|
|
|
|
$hack_broadcast_time = strtok($hack_broadcast_time, 'T');
|
|
|
|
$hack_broadcast_time = strtok('T');
|
2016-08-22 19:55:59 +03:00
|
|
|
$item['timestamp'] = strtotime($element['scheduled_on'].'T'.$hack_broadcast_time);
|
|
|
|
$item['title'] = $element['title'];
|
2015-10-30 13:26:49 +03:00
|
|
|
if (!empty($element['subtitle']))
|
2016-08-22 19:55:59 +03:00
|
|
|
$item['title'] = $element['title'].' | '.$element['subtitle'];
|
|
|
|
$item['duration'] = round((int)$element['duration']/60);
|
|
|
|
$item['content'] = $element['teaser'].'<br><br>'.$item['duration'].'min<br><a href="'.$item['uri'].'"><img src="' . $element['thumbnail_url'] . '" /></a>';
|
2014-05-26 02:30:46 +04:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCacheDuration(){
|
|
|
|
return 1800; // 30 minutes
|
|
|
|
}
|
|
|
|
}
|