[Arte+7] remove-merge bridges, 2 lists for language selection

This commit is contained in:
Mitsukarenai 2015-10-31 13:26:56 +01:00
parent b339f157c1
commit ba161b0b12
2 changed files with 17 additions and 86 deletions

View file

@ -1,22 +1,22 @@
<?php <?php
/** /**
* RssBridgeArte7de * RssBridgeArte7
* Returns images from given page and tags
* *
* @name Arte +7 DE * @name Arte +7
* @homepage http://www.arte.tv/guide/de/plus7 * @homepage http://www.arte.tv/
* @description Returns newest videos from ARTE +7 (german) * @description Returns newest videos from ARTE +7
* @maintainer mitsukarenai * @maintainer mitsukarenai
* @update 2015-10-30 * @update 2015-10-31
* @use1(list|cat="Alle Videos=>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") * @use1(list|catfr="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")
* @use2(list|catde="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")
*/ */
class Arte7deBridge extends BridgeAbstract{ class Arte7Bridge extends BridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
function extractVideoset($category='alle-videos') function extractVideoset($category='toutes-les-videos', $lang='fr')
{ {
$url = 'http://www.arte.tv/guide/de/plus7/'.$category; $url = 'http://www.arte.tv/guide/'.$lang.'/plus7/'.$category;
$input = file_get_contents($url) or die('Could not request ARTE.'); $input = file_get_contents($url) or die('Could not request ARTE.');
if(strpos($input, 'categoryVideoSet') !== FALSE) if(strpos($input, 'categoryVideoSet') !== FALSE)
{ {
@ -34,10 +34,12 @@ class Arte7deBridge extends BridgeAbstract{
return $input; return $input;
} }
$category='alle-videos'; $category='toutes-les-videos'; $lang='fr';
if (!empty($param['cat'])) if (!empty($param['catfr']))
$category=$param['cat']; $category=$param['catfr'];
$input_json = extractVideoset($category); if (!empty($param['catde']))
{ $category=$param['catde']; $lang='de'; }
$input_json = extractVideoset($category, $lang);
foreach($input_json['videos'] as $element) { foreach($input_json['videos'] as $element) {
$item = new \Item(); $item = new \Item();
@ -58,7 +60,7 @@ class Arte7deBridge extends BridgeAbstract{
} }
public function getName(){ public function getName(){
return 'Arte7de'; return 'Arte7';
} }
public function getURI(){ public function getURI(){

View file

@ -1,71 +0,0 @@
<?php
/**
* RssBridgeArte7fr
* Returns images from given page and tags
*
* @name Arte +7 FR
* @homepage http://www.arte.tv/guide/fr/plus7
* @description Returns newest videos from ARTE +7 (french)
* @maintainer mitsukarenai
* @update 2015-10-30
* @use1(list|cat="Toutes les vidéos=>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")
*/
class Arte7frBridge extends BridgeAbstract{
public function collectData(array $param){
function extractVideoset($category='toutes-les-videos')
{
$url = 'http://www.arte.tv/guide/fr/plus7/'.$category;
$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;
}
$category='toutes-les-videos';
if (!empty($param['cat']))
$category=$param['cat'];
$input_json = extractVideoset($category);
foreach($input_json['videos'] as $element) {
$item = new \Item();
$item->uri = $element['url'];
$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);
$item->thumbnailUri = $element['thumbnail_url'];
$item->title = $element['title'];
if (!empty($element['subtitle']))
$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="' . $item->thumbnailUri . '" /></a>';
$this->items[] = $item;
}
}
public function getName(){
return 'Arte7fr';
}
public function getURI(){
return 'http://www.arte.tv/';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}