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