Trinket

default.py

Feb 3rd, 2013
46
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import xbmc
  2. import subprocess,os
  3. class Screensaver(xbmc.Monitor) :
  4.         print("[CUSTOM SCRIPT]Checking PlayBackState")
  5.         def __init__ (self):
  6.                 xbmc.Monitor.__init__(self)
  7.  
  8.         def onScreensaverDeactivated(self):
  9.                 print("[CUSTOM SCRIPT]XBMC in use")
  10.                 os.system("sudo python /home/xbian/.xbmc/addons/service.procmanager/resources/stopall.py") #Calls another script to stop process
  11.  
  12.         def onScreensaverActivated(self):
  13.                 print("[CUSTOM SCRIPT]XBMC in Standby")
  14.                 os.system("sudo python /home/xbian/.xbmc/addons/service.procmanager/resources/startall.py") #Calls another script to start process
  15.  
  16.         def onAbortRequested(self):
  17.                 print("[CUSTOM SCRIPT]XBMC is closing")
  18.                 os.system("sudo python /home/xbian/.xbmc/addons/service.procmanager/resources/startall.py") #Makes sure processes are running if xbmc gets closed
  19.  
  20. print("[CUSTOM SCRIPT]**Working**")
  21.  
  22. monitor=Screensaver()
  23.  
  24. while not xbmc.Monitor().onAbortRequested(): #End if XBMC closes
  25.         xbmc.sleep(5000) #Repeat (ms)
RAW Paste Data