Advertisement
SharkyEXE

Untitled

Jun 17th, 2018
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. # (c) 2boom mod
  2. from Components.Converter.Converter import Converter
  3. from enigma import iServiceInformation, iPlayableService, iPlayableServicePtr
  4. from Components.Element import cached
  5.  
  6.  
  7. class ServiceOrbitalPosition2(Converter, object):
  8.  
  9. def __init__(self, type):
  10. Converter.__init__(self, type)
  11.  
  12. @cached
  13. def getText(self):
  14. service = self.source.service
  15. if isinstance(service, iPlayableServicePtr):
  16. info = service and service.info()
  17. ref = None
  18. else: # reference
  19. info = service and self.source.info
  20. ref = service
  21. if info is None:
  22. return ""
  23. if ref:
  24. transponder_info = info.getInfoObject(ref, iServiceInformation.sTransponderData)
  25. else:
  26. transponder_info = info.getInfoObject(iServiceInformation.sTransponderData)
  27. if ref:
  28. refString = ref.toString().lower()
  29. if "%3a//" in refString:
  30. return _("Stream")
  31. if refString.startswith("1:134:"):
  32. return _("Altern")
  33. if transponder_info and "orbital_position" in transponder_info.keys():
  34. pos = int(transponder_info["orbital_position"])
  35. direction = 'E'
  36. if pos > 1800:
  37. pos = 3600 - pos
  38. direction = 'W'
  39. return "%d%d%s" % (pos/10, pos%10, direction)
  40. return "picon_default"
  41.  
  42. text = property(getText)
  43.  
  44. def changed(self, what):
  45. if what[0] != self.CHANGED_SPECIFIC or what[1] in [iPlayableService.evStart]:
  46. Converter.changed(self, what)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement