2014-07-26, 03:28
Hi guys, I don't know if I'm doing something wrong or if this is an issue but I'm trying to "track" the Player events like onPlayBackStarted, onPlayBackPaused etc ... but I receive nothing.
Anybody knows why?
Thanks,
Anybody knows why?
Code:
import sys
import xbmcgui
import xbmcplugin
plugin_handle = int(sys.argv[1])
class LMS(xbmc.Player):
url = 'http://localhost/xml/test.xml'
data = ''
def __init__(self, *args):
sys.stdout.write("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ prepare")
data = self.getData()
root = data.findall('movie')
for node in root:
name = '%s' % node.find('name').text
video = '%s' % node.find('video').text
thumb = '%s' % node.find('thumb').text
self.addVideoItem(video, {'title': name}, thumb)
def getData(self):
try:
request = urllib2.Request(self.url, headers={"Accept": "application/xml"})
u = urllib2.urlopen(request)
return ET.parse(u)
except urllib2.URLError, e:
return False
def addVideoItem(self, url, infolabels, img=''):
listitem = xbmcgui.ListItem(infolabels['title'], iconImage=img, thumbnailImage=img)
listitem.setInfo('video', infolabels)
listitem.setProperty('IsPlayable', 'true')
xbmcplugin.addDirectoryItem(plugin_handle, url, listitem, isFolder=False)
def onPlayBackStarted(self):
print "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ playing videoooo"
def onPlayBackEnded(self):
print "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ playback ended"
def onPlayBackStopped(self):
print "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ playback stopped"
def onPlayBackPaused(self):
print "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ playback paused"
lms = LMS()
xbmcplugin.endOfDirectory(plugin_handle)
Thanks,