Kathrein UFS-9xx auslesen

Oder gar als Gamma, wenn Dir Beta noch zu viel ist… :stuck_out_tongue:

Man man… die nervigen Kollegen wieder. :stuck_out_tongue:

Okay… hier ohne viel drumrum das Skript

Die Variable Channelmatrix funktioniert so…
Stringvariable erstellen - ID eintragen - und die Programme des Receivers entsprechend verteilen. Natürlich nicht mehr Channels verteilen, als runtergeladen werden. (maxChannels)

Es wird mein orga.php Includefile benötigt, und die Buttons sind wie in diesem Thread beschrieben erstellt. Also auch hier noch eben die entsprechenden CSS + JS + PHP Files runterladen und installieren. Aber eigentlich funktionieren die bisher eh noch nicht, sondern werden nur dargestellt - wie ich es demnächst mal machen möchte. Sofern die Popup Instanz released wurde.

https://www.symcon.de/forum/threads/27917-IPS-Funktionen-in-einer-HTMLBox-nutzen?p=260995#post260995

Gruß
Kevin


<?
// V1.00	28.05.2015 - Erstes Release

// Dieses Skript erzeugt automatisch in einer Kategorie die Programmliste aus einem Kathrein Satellitenreceiver
//
//  © by Kevin Heidrich 2015
//			kevinheidrich@me.com
//  Web: www.kh-solutions.de

// Vorgehensweise:

//[kathreinCatID]-Kategorie
//  |- Skript

	include "orga.php";
	
	$skriptName = "EPG";
	$kathreinIP = "192.168.0.231";
	$kathreinPort = "9000";
	
	$maxChannels = "20";
	$kathreinCatID = 59003 /*[TV\SAT Receiver]*/ ;

//   $channelMatrix = array( "HTMLBox" => 22398 ,
//									"Matrix" => array(array(1,2,3,4),array(5,6,7,8),array(9,10,11,12),array(13,14,15,16),array(17,18,19,20)));

  $channelMatrix = array( "HTMLBox" => 22398 ,
									"Matrix" => array(array(1,2,3),array(4,5,6),array(7,8,9),array(10,11,12)));

// ----------------------------------------------------------------------------
// Ab hier nichts mehr ändern
// ----------------------------------------------------------------------------

   IPS_LogMessage($skriptName,"Starte Datenabruf vom Receiver");

	$channelListCatID = CreateCategory("Channel","channel", $kathreinCatID);

	$xml = file_get_contents("http://$kathreinIP:$kathreinPort/xmlfeeds/channelTable?max-results=$maxChannels");
 
   if ($xml === false)
   {
      IPS_LogMessage($skriptName,"Konnte Programmplätze nicht laden!");
      die(0);
   }
 
	$xmlObjectList = simplexml_load_string($xml);

	foreach($xmlObjectList->channel as $channelEntry)
	{
	 	$channelEntry->channelName = mb_convert_encoding($channelEntry->channelName, 'ISO-8859-15', "UTF-8");

		$channelName = str_replace(array(" ",".","-","/"),"_",$channelEntry->channelName);
		$channelName = str_replace("ä","ae",$channelName);
		$channelName = str_replace("ö","oe",$channelName);
		$channelName = str_replace("ü","ue",$channelName);
		$channelName = str_replace("ß","ss",$channelName);

		$channelCatID = CreateCategory((string)$channelEntry->channelName,"channel_".$channelName, $channelListCatID);

		CreateVariable("Programmplatz",3,(int)$channelEntry->channelNumber, "channel_".$channelName."_number",$channelCatID);

// Alter EPG Zustand
		$varID = IPS_GetObjectIDByIdent("channel_".$channelName."_epgnow",$channelCatID);
		$oldEPG = GetValue($varID);


		$imagePath = "/user/Img/Senderlogo/".(string)$channelEntry->channelName.".png";

		CreateVariable("Icon",3,$imagePath, "channel_".$channelName."_icon",$channelCatID);

		// EPG auslesen
		$xml = file_get_contents("http://$kathreinIP:$kathreinPort/xmlfeeds/scheduleEpgTable?max-results=1&start-index=".(int)$channelEntry->channelNumber);

		if ($xml === false)
		{
	      IPS_LogMessage($skriptName,"Konnte EPG für Kanal ".(string)$channelEntry->channelName." nicht laden!");
	      $epgNowMatrix[(int)$channelEntry->channelNumber] = $oldEPG;
	      continue;
	   }

		$epg = simplexml_load_string($xml);
//		echo "EPG";
//		print_r($epg);
/*
     [title] => Sturm der Liebe (2231)
     [progress] => 92
     [progId] => 35759
     [startTime] => 1433318100
     [endTime] => 1433321040
*/

		if (isset($epg->event[0]))
		{
			$epgNow = $epg->event[0];

			$title = mb_convert_encoding($epgNow->title, 'ISO-8859-15', "UTF-8");
			$startTime = date("H:i",(int)$epgNow->startTime);
			$endTime = date("H:i",(int)$epgNow->endTime);
			$progress = (int)$epgNow->progress;
		}
		else
		{
			$title = "Kein EPG";
			$startTime = "00:00";
			$endTime = "00:00";
			$progress = 0;
		}


//print_r($epgNow);
		// -----------------------------------
		// Aktuelles Programm
		// -----------------------------------
		

		$epgNowHTML = "<link rel='stylesheet' href='/user/progressbar.css'><link rel='stylesheet' href='/user/IPSJS/myButton.css'>";
		$epgNowHTML .= "<table style='background-color:#1f2f3f;border:1px solid #2c4259;width:100%;height:100%;'>";
		$epgNowHTML .= "<tr><td rowspan='3' style='width:50px;height:100%;vertical-align:middle;'><img style='width:50px;margin:0;' src='".$imagePath."'></td>";
		$epgNowHTML .= "<td><div style='overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:150px;'>".$title."</div></td>";
		$epgNowHTML .= "<td style='width:250px;text-align:right;'><div style='background-color:green;' class='myButton'>Live</div><div class='myButton'>Umschalten</div><div style='background-color:blue;' class='myButton'>Info</div></td></tr>";
		$epgNowHTML .= "<tr><td colspan='2' style='font-size:12px;color:gray;'>".$startTime." - ".$endTime."</td></tr>";
		$epgNowHTML .= "<tr><td colspan='2'><div class='meter'><span style='width: ".$progress."%'></span></div></td></tr>";
		$epgNowHTML .= "</table>";

		$epgNowMatrix[(int)$channelEntry->channelNumber] = $epgNowHTML;
		
		CreateVariable("Gerade läuft",3,$epgNowHTML, "channel_".$channelName."_epgnow",$channelCatID);
		$varID = IPS_GetObjectIDByIdent("channel_".$channelName."_epgnow",$channelCatID);
		IPS_SetVariableCustomProfile($varID, "~HTMLBox");
		// -----------------------------------
		// Komplettes Programm
		// -----------------------------------

		
	}

		// -----------------------------------
		// Channelmatrix bilden
		// -----------------------------------
		$htmlMatrix = "<table style='width:100%'>";
      foreach($channelMatrix["Matrix"] as $rowKey => $row)
      {
         $cellWidth = 100/sizeof($row);
         $htmlMatrix .= "<tr>";
         foreach($row as $colKey => $cell)
         {
            $htmlMatrix .= "<td style='width:".$cellWidth."%'>";
            
            if (isset($epgNowMatrix[$cell]))
		         $htmlMatrix .= $epgNowMatrix[$cell];
				else
				   $htmlMatrix .= "Program not found";
				   
				$htmlMatrix .= "</td>";
         }
         $htmlMatrix .= "</tr>";
		}
		$htmlMatrix .= "</table>";

		SetValue($channelMatrix["HTMLBox"],$htmlMatrix);

?>


orga.php.zip (739 Bytes)

Hier noch meine Senderlogo Sammlung, damit das auch irgendwie gut aussehen kann. Bitte nach /webfront/user/img/Senderlogo kopieren.

http://www.kh-solutions.de/Senderlogo.rar

Hallo Kevin,

vielen Dank fuer das Script, das hilft schon weiter. Leider hatte ich noch immer das Problem aus Post 1, was wohl
bei mir daran lag, dass der Port nicht sauber übergeben wird. Ich habe nun mit cURL gelöst. Falls noch jemand das Problem hat , hier der Teil zum Auslesen, wie es bei mir funktioniert :


<?

   $skriptName = "EPG";
   $kathreinIP = "192.168.0.166";
   $kathreinPort = "9000";

   $maxChannels = "20";

$cURL = curl_init("http://$kathreinIP/xmlfeeds/channelTable?max-results=$maxChannels");
curl_setopt($cURL,CURLOPT_PORT,$kathreinPort);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, $kathreinPort);

$xml = curl_exec($cURL);

?>

Gruss Thomas