Skip to content

Commit

Permalink
add transcoding function from Vu+ patch
Browse files Browse the repository at this point in the history
for STB's without transcoding feature there should be no changes
readd streaming port config value for compatibility, but the value can not be changed within the OSD GUI
  • Loading branch information
plnick committed Aug 21, 2013
1 parent 7c9487f commit d7a91d7
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 2 deletions.
8 changes: 7 additions & 1 deletion plugin/controllers/ajax.py
Expand Up @@ -55,7 +55,13 @@ def P_channels(self, request):
stype = request.args["stype"][0]
if "id" in request.args.keys():
idbouquet = request.args["id"][0]
return getChannels(idbouquet, stype)
channels = getChannels(idbouquet, stype)
info = getInfo()
model = info["model"]
channels['transcoding'] = False
if model in ("solo2", "duo2"):
channels['transcoding'] = True
return channels


def P_eventdescription(self, request):
Expand Down
10 changes: 9 additions & 1 deletion plugin/controllers/models/stream.py
Expand Up @@ -7,6 +7,7 @@
# #
##############################################################################
from enigma import eServiceReference, getBestPlayableServiceReference
from info import getInfo
from urllib import unquote, quote
import os
from Components.config import config
Expand Down Expand Up @@ -42,7 +43,14 @@ def getStream(session, request, m3ufile):
progopt="#EXTVLCOPT:program=%d\n" % (int(sRef.split(':')[3],16))
else:
progopt=""
response = "#EXTM3U \n#EXTVLCOPT--http-reconnect=true \n%shttp://%s:8001/%s\n" % (progopt,request.getRequestHostname(), sRef)
portNumber = config.OpenWebif.streamport.value
info = getInfo()
model = info["model"]
if model in ("solo2","duo2"):
if "device" in request.args :
if request.args["device"][0] == "phone" :
portNumber = 8002;
response = "#EXTM3U \n#EXTVLCOPT--http-reconnect=true \n%shttp://%s:%s/%s\n" % (progopt,request.getRequestHostname(), portNumber, sRef)
request.setHeader('Content-Type', 'application/text')
return response

Expand Down
9 changes: 9 additions & 0 deletions plugin/controllers/views/ajax/channels.tmpl
Expand Up @@ -15,9 +15,18 @@
<a href="#" onclick="open_epg_pop('$channel.ref')">
<img src="../images/ico_epg.png" title="Show EPG for $channel.name" border="0">
</a>
#if $transcoding
<a href="#" onclick="jumper8001('$channel.ref', '$channel.name');">
<img align="top" src="../images/ico_stream.png" title="Stream $channel.name" border="0">
</a>
<a href="#" onclick="jumper8002('$channel.ref', '$channel.name');">
<img align="top" src="../images/ico_stream.png" title="Stream Port 8002 $channel.name" border="0">
</a>
#else
<a target="_blank" href='/web/stream.m3u?ref=$channel.ref&name=$channel.name'>
<img align="top" src="../images/ico_stream.png" title="Stream $channel.name" border="0">
</a>
#end if
#else
<a target="_blank" href='#'>
<img align="top" src="../images/ico_lock.png" title="Locked" border="0">
Expand Down
6 changes: 6 additions & 0 deletions plugin/controllers/views/main.tmpl
Expand Up @@ -8,6 +8,7 @@
<script type="text/javascript" src="/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript" src="/js/openwebif.js"></script>
<script type="text/javascript" src="/js/transcoding.js"></script>

<title>Open Webif</title>
</head>
Expand Down Expand Up @@ -196,5 +197,10 @@
<div id="footer"><h3>&nbsp;&nbsp;<a href="https://github.com/E2OpenPlugins">E2OpenPlugins</a> | <a href="http://www.vuplus-community.net">Black Hole</a> | <a href="http://openpli.org">OpenPli</a> | <a href="http://forum.sifteam.eu">Sif</a> | <a href="http://www.vuplus-support.org">Vti</a></h3></div>
</div>
</div>
<form name="portForm" action="/web/stream.m3u" method="GET" target="_blank">
<input type="hidden" name="ref">
<input type="hidden" name="name">
<input type="hidden" name="device">
</form>
</body>
</html>
1 change: 1 addition & 0 deletions plugin/plugin.py
Expand Up @@ -28,6 +28,7 @@
config.OpenWebif.enabled = ConfigYesNo(default=True)
# Use temporary port 8088 to avoid conflict with Webinterface
config.OpenWebif.port = ConfigInteger(default = 80, limits=(1, 65535) )
config.OpenWebif.streamport = ConfigInteger(default = 8001, limits=(1, 65535) )
config.OpenWebif.auth = ConfigYesNo(default=False)
config.OpenWebif.xbmcservices = ConfigYesNo(default=False)
config.OpenWebif.webcache = ConfigSubsection()
Expand Down
58 changes: 58 additions & 0 deletions plugin/public/js/transcoding.js
@@ -0,0 +1,58 @@
// VuPlus Port Jumper
// 2012.12.10
function getWinSize(win) {
if(!win) win = window;
var s = {};
if(typeof win.innerWidth != "undefined") {
s.screenWidth = win.screen.width;
s.screenHeight = win.screen.height;
} else {
s.screenWidth = 0;
s.screenHeight = 0;
}
return s;
}

function getDeviceType() {
var ss = getWinSize();
var screenLen = 0;

if( ss.screenHeight > ss.screenWdith ) {
screenLen = ss.screenHeight;
} else {
screenLen = ss.screenWidth;
}

if( screenLen < 500 ) {
return "phone";
} else {
return "tab";
}
}

function getOSType() {
var agentStr = navigator.userAgent;

if(agentStr.indexOf("iPod") > -1 || agentStr.indexOf("iPhone") > -1)
return "ios";
else if(agentStr.indexOf("Android") > -1)
return "android";
else
return "unknown";
}

function jumper8002( sref, sname ) {
var deviceType = getDeviceType();
document.portForm.ref.value = sref;
document.portForm.name.value = sname;
document.portForm.device.value = "phone";
document.portForm.submit();
}

function jumper8001( sref, sname ) {
var deviceType = getDeviceType();
document.portForm.ref.value = sref;
document.portForm.name.value = sname;
document.portForm.device.value = "etc";
document.portForm.submit();
}

0 comments on commit d7a91d7

Please sign in to comment.