enigma2: fixed hbbtv browser user agent handling
[opendreambox.git] / meta-opendreambox / recipes-dreambox / enigma2 / enigma2-3.999git20140624 / 0001-HbbTV.py-fixed-UserAgent-handling.patch
1 From 645477016905644de45eb4393d5526465cf75b23 Mon Sep 17 00:00:00 2001
2 From: ghost <andreas.monzner@dream-property.net>
3 Date: Fri, 27 Jun 2014 17:36:26 +0200
4 Subject: [PATCH] HbbTV.py: fixed UserAgent handling
5
6 ---
7  usr/lib/enigma2/python/Plugins/Extensions/HbbTV/HbbTV.py |   10 ++++++++--
8  1 file changed, 8 insertions(+), 2 deletions(-)
9
10 diff --git a/usr/lib/enigma2/python/Plugins/Extensions/HbbTV/HbbTV.py b/usr/lib/enigma2/python/Plugins/Extensions/HbbTV/HbbTV.py
11 index 4eb80b8..d980590 100644
12 --- a/usr/lib/enigma2/python/Plugins/Extensions/HbbTV/HbbTV.py
13 +++ b/usr/lib/enigma2/python/Plugins/Extensions/HbbTV/HbbTV.py
14 @@ -79,6 +79,8 @@ class HbbTV(object):
15                 assert HbbTV.instance is None, "HbbTV is a singleton class and may only be initialized once!"
16                 HbbTV.instance = self
17  
18 +               self.prevUAState = False
19 +               self.prevUA = ""
20                 self.session = session
21                 self._redButtonApp = None
22                 self._textApp = None
23 @@ -223,6 +225,8 @@ class HbbTV(object):
24                 self._unsetVideoWindow()
25                 self.stopStream()
26                 self.__browser = None
27 +               config.mediaplayer.useAlternateUserAgent.value = self.prevUAState
28 +               config.mediaplayer.alternateUserAgent.value = self.prevUA
29  
30         def zap(self, sref):
31                 self.session.nav.playService(eServiceReference(sref))
32 @@ -248,8 +252,6 @@ class HbbTV(object):
33                 self._showVideoIfAvail()
34  
35         def _playStream(self, sref):
36 -               if self.__browser:
37 -                       config.mediaplayer.alternateUserAgent.value = self.__browser.getUserAgent()
38                 self.eHbbtv.setStreamState(eHbbtv.STREAM_STATE_CONNECTING)
39                 self.session.nav.stopService()
40                 self.session.nav.playService(eServiceReference(sref))
41 @@ -373,6 +375,10 @@ class HbbTV(object):
42                         self.__browser.onUrlChanged.append(self._onUrlChanged)
43                         self.__browser.onExecBegin.append(self._showVideoIfAvail)
44                         self.__browser.onExecEnd.append(self._hideVideoIfAvail)
45 +                       self.prevUAState = config.mediaplayer.useAlternateUserAgent.value
46 +                       self.prevUA = config.mediaplayer.alternateUserAgent.value
47 +                       config.mediaplayer.useAlternateUserAgent.value = True
48 +                       config.mediaplayer.alternateUserAgent.value = self.__browser.getUserAgent()
49  
50         def startApplicationById(self, appid):
51                 uri = self.eHbbtv.resolveApplicationLocator("dvb://current.ait/%s" % appid)
52 -- 
53 1.7.10.4
54