aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>2006-03-05 07:49:30 +0000
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>2006-03-05 07:49:30 +0000
commitc59bcd0084df4c2803f2eae50988b5a54bc8ab00 (patch)
tree02a7cac4f2b9323457f2d50436c7efa27acc7cd5 /lib/python
parent78ce52830c453fc6e442999da0b7748509694bb8 (diff)
downloadenigma2-c59bcd0084df4c2803f2eae50988b5a54bc8ab00.tar.gz
enigma2-c59bcd0084df4c2803f2eae50988b5a54bc8ab00.zip
fix ZappingAlternatives - it SHOULD work now...
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Plugins/Extensions/ZappingAlternatives/plugin.py55
1 files changed, 48 insertions, 7 deletions
diff --git a/lib/python/Plugins/Extensions/ZappingAlternatives/plugin.py b/lib/python/Plugins/Extensions/ZappingAlternatives/plugin.py
index 424641c9..ebd523f9 100644
--- a/lib/python/Plugins/Extensions/ZappingAlternatives/plugin.py
+++ b/lib/python/Plugins/Extensions/ZappingAlternatives/plugin.py
@@ -234,14 +234,54 @@ class AlternativeZapping(Screen):
oldPlayService = NavigationInstance.instance.playService
+from Components.PerServiceDisplay import PerServiceDisplay
+
+class ServiceChanged(PerServiceDisplay):
+ def __init__(self, navcore):
+ PerServiceDisplay.__init__(self, navcore,
+ {
+ iPlayableService.evTuneFailed: self.tuneFailed,
+ iPlayableService.evStart: self.start
+ })
+
+ self.lastPlayAction = None
+ self.nextPlayTry = 0
+
+ def start(self):
+# print "+++++++++++++++++++++++++++++++++++++++++++++++++Start", self.lastPlayAction
+ if self.lastPlayAction is not None:
+ self.lastPlayAction = None
+
+ def tuneFailed(self):
+# print "+++++++++++++++++++++++++++++++++++++++++++++++++Tuning failed!", self.lastPlayAction
+ ref = self.lastPlayAction
+# print "Ref:", ref
+# print "Alternatives: failed to play service"
+ if ref is not None:
+ if alternatives.has_key(ref):
+# print "Alternatives: trying alternatives"
+ if len(alternatives[ref]) > self.nextPlayTry:
+# print "Alternatives: trying alternative", alternatives[ref][self.nextPlayTry]
+ if oldPlayService(ServiceReference(alternatives[ref][self.nextPlayTry]).ref) == 0:
+ self.nextPlayTry += 1
+# print "Alternatives: Alternative found!"
+ else:
+ self.nextPlayTry += 1
+# print "Alternatives: Alternative doesn't play either"
+ self.tuneFailed()
+
+ #print "Alternatives: No playable alternative found!"
+
+servicechanged = ServiceChanged(NavigationInstance.instance)
+
def playService(self, ref):
- if not oldPlayService(ref):
- if alternatives.has_key(str(ServiceReference(ref))):
- for x in alternatives[str(ServiceReference(ref))]:
- if oldPlayService(ServiceReference(x).ref):
- return 1
- return 0
- return 1
+ #print "--------------------Alternatives: trying to play service", str(ServiceReference(ref))
+ servicechanged.lastPlayAction = str(ServiceReference(ref))
+ servicechanged.nextPlayTry = 0
+ result = oldPlayService(ref)
+
+
+ return result
def autostart(reason):
if reason == 0:
@@ -250,6 +290,7 @@ def autostart(reason):
except:
pass
NavigationInstance.instance.playService = type(NavigationInstance.instance.playService)(playService, NavigationInstance, Navigation)
+
def AlternativeZappingSetup(session):
session.open(AlternativeZapping)