PDA

View Full Version : [LINUX] xbmc.Player() callbacks not working


analogue
2008-10-31, 05:52
I can't seem to get the callbacks for xbmc.Player working on the latest atlantis release or trunk. Heres a short script to reproduce. Is this a bug or am i missing something?


import xbmcgui
import xbmc
import time

xbmc.log('\n\n\nHello world\n\n\n')

class MyPlayer(xbmc.Player):

def __init__(self):
xbmc.Player.__init__(self)

def onPlayBackStarted(self):
xbmc.log('*** CALLBACK: onPlayBackStarted')

def onPlayBackEnded( self ):
xbmc.log('*** CALLBACK: onPlayBackSEnded')

def onPlayBackStopped( self ):
xbmc.log('*** CALLBACK: onPlayBackStopped')

player = MyPlayer()
player.play('/tmp/movie.mpg')
while True:
xbmc.log('Sleeping...')
time.sleep(1)
xbmc.log('\n\n\nGoodbye world\n\n\n')
tnx!

Nuka1195
2008-10-31, 18:13
has that ever worked for you?

seems to me i needed a window or dialog, with a dummy thread running constantly for it to update.

when a song changes, try navigating in xbmc and see if that triggers the event.

edit: maybe just try and run a dummy timer thread, thats what i do in xbmc lyrics

analogue
2008-11-04, 06:30
I've never used it before, so I can't say I've ever seen it working. I think a pointer to an example of code which actually uses the callbacks would be the best thing for me look at at this point. Do you have any examples?

rwparris2
2008-11-04, 07:31
onplaybackstarted & onplaybackended works for me in LastTube. The only problem I have had with it is pressing next seems to trigger onplaybackstopped :(