[LINUX] xbmc.Player() callbacks not working
#1
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?

Code:
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!
Reply
#2
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
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#3
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?
Reply
#4
onplaybackstarted & onplaybackended works for me in LastTube. The only problem I have had with it is pressing next seems to trigger onplaybackstopped Sad
Always read the XBMC online-manual, FAQ and search and search the forum before posting.
For troubleshooting and bug reporting please read how to submit a proper bug report.

If you're interested in writing addons for xbmc, read docs and how-to for plugins and scripts ||| http://code.google.com/p/xbmc-addons/
Reply
#5
Hi all,

I am having the same problem as the original poster: callbacks are not working at all. This is on Windows. I've downloaded the LastTube plug-in, and even there callbacks do not seem to be called (no messages in debug log).

If someone could share a minimal example of a working script or plugin with working callbacks, that would be wonderful. Thanks!
Reply
#6
Ok, I found my error. (I still do not know why LastTube's callbacks did not work for me though.) The error in my code was that I used time.sleep() instead of sbmc.sleep(). Somehow not using sbmc.sleep() prevents _PyXBMC_MakePendingCalls() from being called.
Reply

Logout Mark Read Team Forum Stats Members Help
[LINUX] xbmc.Player() callbacks not working0