Events and timers?
#1
Hi,

First of all, I would like to thank the developers for making such an awesome XBox dashboard, I've had lots of fun with it and have stopped using my pc as a media center.

I'm making a 'now playing' script for XBMC and mIRC, and need some advice. Right now, the script runs in an aweful while loop that gets the song info every 20 seconds and I would like it to use an event for when XBMC changes the current song. I've not dug very deep into the documentation -mainly because it's not very well documented afaik Wink- and my python skills have known better times.

If this is not possible, I would like to know how to get rid of the aweful loop, and switch to a more .. proper way of having a timer.

And one more question, could you list the getMusicInfoTag functions?

Cheers,
art0rz
Reply
#2
My apologies for the double post, I couldnt find the edit button.

It seems I overlooked the HttpApi page. Wink No need for a python script now. Smile
Reply
#3
http://home.no.net/thor918/xbmc/xbmc.html
http://home.no.net/thor918/xbmc/xbmcgui.html

The following is what I use, thanks to Thor918. I call it with the following:

self.MyPlayer = MyPlayer( xbmc.PLAYER_CORE_MPLAYER, function = self.myPlayerChanged )


Code:
## Thanks Thor918 for this class ##
class MyPlayer( xbmc.Player ):
    def  __init__( self, *args, **kwargs ):
        if ( kwargs.has_key( 'function' )):
            self.function = kwargs['function']
            xbmc.Player.__init__( self )

    def onPlayBackStopped( self ):
        self.function( 0 )

    def onPlayBackEnded( self ):
        self.function( 1 )

    def onPlayBackStarted( self ):
        self.function( 2 )
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply

Logout Mark Read Team Forum Stats Members Help
Events and timers?0