Advertisement
Trinket

default.py

Jan 31st, 2013
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. import xbmc
  2. import subprocess,os
  3.  
  4. xbmc.log(msg="***WORKING1***",level=xbmc.LOGDEBUG)
  5. print("**Working1**")
  6.  
  7. class MyPlayer(xbmc.Player) :
  8.  
  9.         def __init__ (self):
  10.                 xbmc.Player.__init__(self)
  11.  
  12.         def onPlayBackStarted(self):
  13.                 if xbmc.Player().isPlayingVideo():
  14.                         os.system("sudo python ~/.xbmc/addon/script.service.procmanager/resources/stopall.py") #Calls another script to stop proceses
  15.  
  16.         def onPlayBackEnded(self):
  17.                 if (VIDEO == 0): #If no video playing
  18.                         os.system("sudo python ~/.xbmc/addon/script.service.procmanager/resources/startall.py") #Calls another script to start proceses
  19.  
  20. xbmc.log(msg="***WORKING2***",level=xbmc.LOGDEBUG)
  21. print("**Working2**")
  22.  
  23.  
  24. player=MyPlayer()
  25.  
  26. while(1): #Do this in order to know when video isn't playing
  27.         if xbmc.Player().isPlayingVideo():
  28.                 VIDEO = 1
  29.  
  30.         else:
  31.                 VIDEO = 0
  32.  
  33. xbmc.sleep(3000) #Repeat (ms)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement