This PHP script will download the channels list from your Enigma2 box at the configured IP address and convert them to an XSPF playlist for VLC player.
The stream URLs inside the playlist will point to the address separately configured. Useful in case you only want to port forward to the internet only the streaming port of the box, not the entire web interface.
To modify the box IP and the URL addresses, please edit this PHP script on your server.
Please note that if the channels list on the box is big (eg. rotor list), it may take a couple of seconds to process the conversion.
<?php // the IP address of the Enigma2 box on the network, with access to the web interface $dreamboxip = "192.168.1.90"; // the entire http address and port of the streaming proxy, usually the same as the box IP and port 8001 $streamaddress = "http://192.168.1.90:8001/"; // the name of the playlist file, extension will be added automatically $playlistfilename = "yourbox_channels_for_vlc"; // based on openwebif api at http://e2devel.com/apidoc/webif/#getallservices //------------------------------------------------------------------------------------------------------------------------------ if(isset($_GET["xspf"])) { if($_GET["xspf"] === "save") { $urlallsvc = "http://" . $dreamboxip . "/web/getallservices"; $allsvc = simplexml_load_file($urlallsvc); $xspf = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL . '<playlist xmlns="http://xspf.org/ns/0/" xmlns:vlc="http://www.videolan.org/vlc/playlist/ns/0/" version="1">' . PHP_EOL . ' <title>TV Channels</title>' . PHP_EOL . ' <trackList>' . PHP_EOL; $i = 0; foreach ($allsvc->e2bouquet as $e2bouquet) { $e2bouquet_name=$e2bouquet->e2servicename; $xspf .= ' <track>' . PHP_EOL . ' <location></location>' . PHP_EOL . ' <title>' . $e2bouquet_name . '</title>' . PHP_EOL . ' </track>' . PHP_EOL; foreach ($allsvc->e2bouquet[$i]->e2servicelist->e2service as $e2service) { $e2service_refr=$e2service->e2servicereference; $e2service_name=$e2service->e2servicename; if (strstr($e2service_refr, "1:64") != false) { $xspf .= ' <track>' . PHP_EOL . ' <location></location>' . PHP_EOL . ' <title>' . $e2service_name . '</title>' . PHP_EOL . ' </track>' . PHP_EOL; } else { $xspf .= ' <track>' . PHP_EOL . ' <location>' . $streamaddress . $e2service_refr . '</location>' . PHP_EOL . ' <title>' . $e2service_name . '</title>' . PHP_EOL . ' </track>' . PHP_EOL; } } $i = $i + 1; } $xspf .= ' </trackList>' . PHP_EOL . '</playlist>' . PHP_EOL; header('Content-Type: plain/text'); header('Content-disposition: attachment; filename=' . $playlistfilename . '.xspf'); print $xspf; } } else { print '<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Enigma2 to VLC</title></head><body>'; print '<h1><b>Enigma2 Channels List Converter</b></h1>'; print 'This PHP script will download the channels list from your Enigma2 box at <b><i>' . $dreamboxip . '</i></b> and convert them to an XSPF playlist for VLC player.<br>'; print 'The stream URLs will point to the address <b><i>' . $streamaddress . '</i></b> inside the playlist.<br>To modify the box and the URL addresses, please edit this PHP script on your server.<br>'; print 'Please note that if the channels list on the box is big (eg. rotor list), it may take a couple of seconds to process the conversion.<br><br>'; print '<a href="' . $_SERVER['REQUEST_URI'] . '?xspf=save">Click here to save the XSPF playlist on your PC</a><br>'; print '</body>'; } ?>
Tested with OpenPLi 3.0 box webinterface OWIF 0.1.7, php script running on Ubuntu 12.04 in the same network.