2013-01-31, 12:30
Now resolved, but will leave for future reference
I am having an issue when I subclass the xbmc.Player class.
In its simplest form I have this in a file called player.py
And I use this from another file like this:
This seems to work okay, and I get the expected entries in the XBMC log depending on whether I stop the stream or let it end (it's only 15 seconds long).
However, and this is my problem, when I use the class again I get 2 "PLAYBACK STARTED" entries in the log, and 2 entries indicating how the stream end, use it again and I get 3, etc etc.
The only way to reset this is to atually quit XBMC (which then has to be done via Task Manager as it doesn't shutdown properly either once I've used the MyPlayer class).
I can only assume it isn't being cleaned up correctly, but I can't work out what needs to be done.
Any help would be most appreciated.
I am having an issue when I subclass the xbmc.Player class.
In its simplest form I have this in a file called player.py
Code:
import xbmc
class MyPlayer(xbmc.Player):
def __init__( self, *args, **kwargs ):
xbmc.Player.__init__( self )
def PlayStream(self, url):
self.play(url)
while self.isPlaying: #<== The should be while self.isPlaying():
xbmc.sleep(1000)
def onPlayBackStarted(self):
print "PLAYBACK STARTED"
def onPlayBackEnded(self):
print "PLAYBACK ENDED"
def onPlayBackStopped(self):
print "PLAYBACK STOPPED"
And I use this from another file like this:
Code:
from player import MyPlayer
MyPlayer().PlayStream('http://sohamcomputerservices.co.uk/TVC-House-V1.flv')
This seems to work okay, and I get the expected entries in the XBMC log depending on whether I stop the stream or let it end (it's only 15 seconds long).
However, and this is my problem, when I use the class again I get 2 "PLAYBACK STARTED" entries in the log, and 2 entries indicating how the stream end, use it again and I get 3, etc etc.
The only way to reset this is to atually quit XBMC (which then has to be done via Task Manager as it doesn't shutdown properly either once I've used the MyPlayer class).
I can only assume it isn't being cleaned up correctly, but I can't work out what needs to be done.
Any help would be most appreciated.