Advertisement
Guest User

default.py

a guest
Oct 13th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.35 KB | None | 0 0
  1. class Main:
  2.     def __init__(self):
  3.         cast = chromecast.get_chromecast()
  4.  
  5.         print()
  6.         print(cast.device)
  7.         time.sleep(1)
  8.         print()
  9.         print(cast.status)
  10.         print()
  11.  
  12.         while not cast.is_idle:
  13.             print("Quitting currently casting app")
  14.             cast.quit_app()
  15.             time.sleep(1)
  16.             break
  17.  
  18.         time.sleep(1)
  19.         cast.play_media(video_url, "video/mp4")
  20.         print("Casting your video %s" % title)
  21.  
  22.         time.sleep(18)
  23.  
  24.         MyDialog()
  25.         cast.quit_app()
  26.  
  27. class MainGui(xbmcgui.WindowXMLDialog):
  28.     def __init__(self, *args, **kwargs):
  29.         xbmcgui.WindowXMLDialog.__init__(self)
  30.  
  31.     def onInit(self):
  32.         pass
  33.  
  34.     def onAction(self, action):
  35.         pass
  36.  
  37.     def onClick(self, controlID):
  38.         if controlID == 112:
  39.             print("Playing")
  40.         elif controlID == 113:
  41.             cast.media_controller.pause()
  42.             print("Paused")
  43.         elif controlID == 114:
  44.             cast.media_controller.stop()
  45.         elif controlID == 115:
  46.             cast.media_controller.seek(cast.media_controller.status.current_time + 10)
  47.         elif controlID == 111:
  48.             cast.media_controller.seek(max(cast.media_controller.status.current_time - 10, 0))
  49.         elif cast.media_controller.status.player_is_idle:
  50.             cast.quit_app()
  51.  
  52.             time.sleep(1)
  53.  
  54.     def onFocus(self, controlId):
  55.         pass
  56.  
  57. def MyDialog():
  58.     ui = MainGui('script-chromecast-main.xml', __path__, 'default')
  59.     ui.doModal()
  60.     del ui
  61.  
  62. if (__name__ == "__main__"):
  63.     Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement