-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
+ 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