Python Script play pause
#1
Hi,

can anybody edit this code so that the # part only execute if the playlist have less two entries?

Code:
import xbmc,xbmcgui
import subprocess,os
import urllib2

class MyPlayer(xbmc.Player) :
  
  def __init__ (self):
      xbmc.Player.__init__(self)
    
  def onPlayBackStarted(self):
    if xbmc.Player().isPlayingVideo():
      urllib2.urlopen('http://192.168.2.111/connair/index.php?action=off&type=group&id=2')
      
  #def onPlayBackEnded(self):
  #  if (VIDEO == 1):
  #    urllib2.urlopen('http://192.168.2.111/connair/index.php?action=on&type=group&id=2')
      
  def onPlayBackStopped(self):
    if (VIDEO == 1):
      urllib2.urlopen('http://192.168.2.111/connair/index.php?action=on&type=group&id=2')
      
  def onPlayBackPaused(self):
    if xbmc.Player().isPlayingVideo():
      urllib2.urlopen('http://192.168.2.111/connair/index.php?action=on&type=group&id=2')
      
  def onPlayBackResumed(self):
    if xbmc.Player().isPlayingVideo():
      urllib2.urlopen('http://192.168.2.111/connair/index.php?action=off&type=group&id=2')
      
player=MyPlayer()

VIDEO = 0

while not xbmc.abortRequested:
  if xbmc.Player().isPlaying():
    if xbmc.Player().isPlayingVideo():
      VIDEO = 1
    else:
      VIDEO = 0
  xbmc.sleep(1000)
Reply

Logout Mark Read Team Forum Stats Members Help
Python Script play pause0