+ 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()
+ else:
+ self.lastPlayAction = None
+
+ #print "Alternatives: No playable alternative found!"
+
+servicechanged = None
+
+def playService(self, ref, **kwargs):
+ #print "--------------------Alternatives: trying to play service", str(ServiceReference(ref))
+ if ref is not None:
+ servicechanged.lastPlayAction = str(ServiceReference(ref))
+ servicechanged.nextPlayTry = 0
+ result = oldPlayService(ref, **kwargs)
+ return result
+
+def sessionstart(reason, session, **kwargs):