Guest
Public paste!

Dam0

By: a guest | Mar 18th, 2010 | Syntax: None | Size: 1.08 KB | Hits: 128 | Expires: Never
Copy text to clipboard
  1. # light.py
  2. #
  3. ###############################################
  4. #
  5. # to add to autorun
  6. # execfile("/home/xbmc/.xbmc/scripts/light.py")
  7. #
  8. ###############################################
  9.  
  10. import xbmc,xbmcgui
  11. import subprocess,os
  12.  
  13. class MyPlayer(xbmc.Player) :
  14.  
  15.         def __init__ (self):
  16.             xbmc.Player.__init__(self)
  17.  
  18.         def onPlayBackStarted(self):
  19.             if xbmc.Player().isPlayingVideo():
  20.                 os.system("LightsDim.py")
  21.  
  22.         def onPlayBackEnded(self):
  23.             if (VIDEO == 1):
  24.                 os.system("LightsBright.py")
  25.  
  26.         def onPlayBackStopped(self):
  27.             if (VIDEO == 1):
  28.                 os.system("LightsBright.py")
  29.  
  30.         def onPlayBackPaused(self):
  31.             if xbmc.Player().isPlayingVideo():
  32.                 os.system("LightsBright.py")
  33.  
  34.         def onPlayBackResumed(self):
  35.             if xbmc.Player().isPlayingVideo():
  36.                 os.system("LightsDim.py")
  37.  
  38. player=MyPlayer()
  39.  
  40. while(1):
  41.     if xbmc.Player().isPlayingVideo():
  42.         VIDEO = 1
  43.  
  44.     else:
  45.         VIDEO = 0
  46.  
  47.     xbmc.sleep(3000)