909a9ae7a912b7f35628eb32a0d4e01cb0ae7f36
[vuplus_openvuplus_3.0] / meta-openvuplus / recipes-vuplus / e2openplugins / enigma2-plugin-extensions-openwebif / openwebif_8001_8002.patch
1 diff --git a/plugin/controllers/models/stream.py b/plugin/controllers/models/stream.py
2 index fe4ddd4..71b1eaa 100644
3 --- a/plugin/controllers/models/stream.py
4 +++ b/plugin/controllers/models/stream.py
5 @@ -25,11 +25,21 @@ def getStream(session, request, m3ufile):
6         if "name" in request.args:
7                 name = request.args["name"][0]
8         # #EXTINF:-1,%s\n  remove not compatiple with old api
9 -       if sRef != '':
10 +
11 +       if "device" in request.args :
12 +               if request.args["device"][0] == "phone" :
13 +                       portNumber = 8002;
14 +               else :
15 +                       portNumber = config.OpenWebif.streamport.value
16 +       else : 
17 +               portNumber = config.OpenWebif.streamport.value
18 +       
19 +       if sRef != '' :
20                 progopt="#EXTVLCOPT:program=%d\n" % (int(sRef.split(':')[3],16))
21         else:
22                 progopt=""
23 -       response = "#EXTM3U \n#EXTVLCOPT--http-reconnect=true \n%shttp://%s:%s/%s\n" % (progopt,request.getRequestHostname(),config.OpenWebif.streamport.value, sRef)
24 +       response = "#EXTM3U \n#EXTVLCOPT--http-reconnect=true \n%shttp://%s:%s/%s\n" % (progopt,request.getRequestHostname(), portNumber, sRef)
25 +       
26         request.setHeader('Content-Type', 'application/text')
27         return response
28  
29 diff --git a/plugin/controllers/views/ajax/channels.tmpl b/plugin/controllers/views/ajax/channels.tmpl
30 index 5975ce8..2915c5b 100755
31 --- a/plugin/controllers/views/ajax/channels.tmpl
32 +++ b/plugin/controllers/views/ajax/channels.tmpl
33 @@ -12,9 +12,12 @@
34                                                         <a href="#" onclick="open_epg_pop('$channel.ref')">
35                                                         <img src="../images/ico_epg.png" title="Show EPG for $channel.name" border="0">
36                                                         </a>
37 -                                                       <a target="_blank" href='/web/stream.m3u?ref=$channel.ref&name=$channel.name'>
38 +                                                       <a href="#" onclick="jumper8001('$channel.ref', '$channel.name');">
39                                                         <img align="top" src="../images/ico_stream.png" title="Stream $channel.name" border="0">
40                                                         </a>
41 +                                                       <a href="#" onclick="jumper8002('$channel.ref', '$channel.name');">
42 +                                                       <img align="top" src="../images/ico_stream.png" title="Stream Port 8002 $channel.name" border="0">
43 +                                                       </a>
44                                                 </div>
45                                         
46  #if $channel.has_key('now_title')
47 diff --git a/plugin/controllers/views/main.tmpl b/plugin/controllers/views/main.tmpl
48 index 1844226..6dcfb66 100755
49 --- a/plugin/controllers/views/main.tmpl
50 +++ b/plugin/controllers/views/main.tmpl
51 @@ -9,6 +9,79 @@
52  <script type="text/javascript" src="/js/jquery-ui-1.8.18.custom.min.js"></script>\r
53  <script type="text/javascript" src="/js/openwebif.js"></script>\r
54  \r
55 +<script>\r
56 +\r
57 +       // VuPlus Port Jumper \r
58 +       // 2012.12.10\r
59 +\r
60 +       function getWinSize(win) {                      \r
61 +               if(!win) win = window;                  \r
62 +               var s = {};                     \r
63 +               \r
64 +               if(typeof win.innerWidth != "undefined") {\r
65 +                       s.screenWidth = win.screen.width;                               \r
66 +                       s.screenHeight = win.screen.height;                     \r
67 +               } else {\r
68 +                       s.screenWidth = 0;                              \r
69 +                       s.screenHeight = 0;                     \r
70 +               }                       \r
71 +\r
72 +               return s;               \r
73 +       }\r
74 +\r
75 +       function getDeviceType() {\r
76 +               var ss = getWinSize();  \r
77 +               var screenLen = 0;\r
78 +\r
79 +               // alert( ss.screenHeight );    \r
80 +               // alert( ss.screenWidth );     \r
81 +\r
82 +               if( ss.screenHeight > ss.screenWdith ) {                \r
83 +                       screenLen = ss.screenHeight;    \r
84 +               } else {                \r
85 +                       screenLen = ss.screenWidth;     \r
86 +               }       \r
87 +\r
88 +               if( screenLen < 500 ) {         \r
89 +                       return "phone"; \r
90 +               } else {\r
91 +                       return "tab";   }\r
92 +       }\r
93 +\r
94 +       function getOSType() {\r
95 +               var agentStr = navigator.userAgent;\r
96 +               \r
97 +               if(agentStr.indexOf("iPod") > -1 || agentStr.indexOf("iPhone") > -1)                            \r
98 +                       return "ios";   \r
99 +               else if(agentStr.indexOf("Android") > -1)               \r
100 +                       return "android";       \r
101 +               else            \r
102 +                       return "unknown";\r
103 +       }\r
104 +\r
105 +       function jumper8002( sref, sname ) {\r
106 +               var deviceType = getDeviceType();\r
107 +\r
108 +               document.portForm.ref.value = sref;\r
109 +               document.portForm.name.value = sname;\r
110 +\r
111 +               document.portForm.device.value = "phone";\r
112 +               document.portForm.submit();\r
113 +       }\r
114 +\r
115 +       function jumper8001( sref, sname ) {\r
116 +               var deviceType = getDeviceType();\r
117 +\r
118 +               document.portForm.ref.value = sref;\r
119 +               document.portForm.name.value = sname;\r
120 +\r
121 +               document.portForm.device.value = "etc";\r
122 +               document.portForm.submit();\r
123 +       }\r
124 +\r
125 +</script>\r
126 +\r
127 +\r
128  <title>Open Webif</title>\r
129  </head>\r
130  \r
131 @@ -195,5 +268,12 @@
132                         <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>\r
133                 </div>\r
134         </div>\r
135 +       \r
136 +       <form name="portForm" action="/web/stream.m3u" method="GET" target="_blank">\r
137 +               <input type="hidden" name="ref">\r
138 +               <input type="hidden" name="name">\r
139 +               <input type="hidden" name="device">\r
140 +       </form>\r
141 +       \r
142  </body>\r
143  </html>\r