Jump to content


Photo

Enigma2 channels list to VLC playlist Converter - php

php vlc playlist stream

  • Please log in to reply
10 replies to this topic

#1 robertut

  • Senior Member
  • 344 posts

+2
Neutral

Posted 14 August 2013 - 15:06

Enigma2 Channels List Converter

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.

 



Re: Enigma2 channels list to VLC playlist Converter - php #2 robertut

  • Senior Member
  • 344 posts

+2
Neutral

Posted 14 August 2013 - 15:33

Please note that the script currently works only if there's no password set to the web interface.



Re: Enigma2 channels list to VLC playlist Converter - php #3 robertut

  • Senior Member
  • 344 posts

+2
Neutral

Posted 14 August 2013 - 15:54

Please find below the script allowing to do the same for password-protected web interfaces and streams.

Note that the password is required for VLC to play the stream too, thus the password will appear in plain text inside the playlist file.

 

<?php

// the IP address of the Enigma2 box on the network, with access to the web interface
$enigma2ip = "192.168.1.90";

// the username and password to webif, in username:password style. if you don't use password protection, just leave empty like "";
$userpass = "root:password";

// the address and port of the streaming proxy, usually the same as the box IP and port 8001
$streamaddress = "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") {

	if ($userpass != "") {
		$userpass .= "@";
	}

	$urlallsvc = "http://" . $userpass . $enigma2ip . "/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>http://' . $userpass . $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>' . $enigma2ip . '</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>';

}

?>

 



Re: Enigma2 channels list to VLC playlist Converter - php #4 Robinson

  • Senior Member
  • 2,523 posts

+30
Good

Posted 22 August 2013 - 11:28

How to execute this script on an OpenPLi image, please?

Also, is this list typical for VLC or can other players, such as Media Player Classic or Windows Media Player, use the list as well?


ET9000, OpenPLi 4.0, 13E, 19E

HD51, OpenPLi 6.2, 75E - 30W


Re: Enigma2 channels list to VLC playlist Converter - php #5 robertut

  • Senior Member
  • 344 posts

+2
Neutral

Posted 22 August 2013 - 13:25

You need Apache+PHP environment to execute this script. There are guides out there which explain how to install these on enigma-based STBs.

 

But the original intention was to run this script not on OpenPLi image, but on a home NAS or server or a PC in your network or similar, which usually has Apache+PHP installed anyway. No need to mess up the OpenPLi installation in any matter. You can run it even on your Windows PC if you have wamp server installed, for example.

 

The playlist generated is in standard XSPF format, which can be played by any recent media player. It contains all the channels from all the bouquets, and includes all the separators and names you originally have on the box - this makes easy to use, your playlist looks quite the same as your channels list on the box.



Re: Enigma2 channels list to VLC playlist Converter - php #6 Robinson

  • Senior Member
  • 2,523 posts

+30
Good

Posted 22 August 2013 - 13:51

OK, and wouldn't it be possible to generate such playlists easier from userbouquet files on a PC without the need of running any servers?

Sorry, just a thought.


ET9000, OpenPLi 4.0, 13E, 19E

HD51, OpenPLi 6.2, 75E - 30W


Re: Enigma2 channels list to VLC playlist Converter - php #7 robertut

  • Senior Member
  • 344 posts

+2
Neutral

Posted 23 August 2013 - 07:48

I'm pretty sure it would be possible. Some script just needs to be written. There are already two ideas how to do that in this forum...



Re: Enigma2 channels list to VLC playlist Converter - php #8 digi2

  • Senior Member
  • 53 posts

+2
Neutral

Posted 3 July 2015 - 10:36

Thank you for this PHP Script.

i have modified for me that i can download "xspf nomal", "xspf transcoded", "m3u normal", "m3u transcoded" list download.



Re: Enigma2 channels list to VLC playlist Converter - php #9 Bhagesh

  • Member
  • 1 posts

0
Neutral

Posted 31 December 2017 - 06:22

Please suggest me how to make m3u file from Enigma2 box

Re: Enigma2 channels list to VLC playlist Converter - php #10 Pr2

  • PLi® Contributor
  • 5,133 posts

+209
Excellent

Posted 1 January 2018 - 20:25

Go into the Webif (connect with your browser to the IP address of your STB).

 

In the channel list click on the TV icon of the favorites and you will dowload the .m3u list from this favorite, you can also download individually download the .m3u for a specific channel.

 

Pr2


NO SUPPORT by PM, it is a forum make your question public so everybody can benefit from the question/answer.
If you think that my answer helps you, you can press the up arrow in bottom right of the answer.

Wanna help with OpenPLi Translation? Please read our Wiki Information for translators

Sat: Hotbird 13.0E, Astra 19.2E, Eutelsat5A 5.0W
VU+ Solo 4K: 2*DVB-S2 + 2*DVB-C/T/T2 (used in DVB-C) & Duo 4K: 2*DVB-S2X + DVB-C (FBC)
Edision OS Mio 4K: 1*DVB-S2X + 1*DVB-C/T/T2
 


Re: Enigma2 channels list to VLC playlist Converter - php #11 imopen

  • Member
  • 5 posts

0
Neutral

Posted 17 October 2018 - 23:29

Go into the Webif (connect with your browser to the IP address of your STB).

 

In the channel list click on the TV icon of the favorites and you will dowload the .m3u list from this favorite, you can also download individually download the .m3u for a specific channel.

 

Pr2

 

Thank you so much, life saver




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users