2013-03-20, 22:43
Hi all,
I'm working on my first addon for xbmc (show online media from bavarian broadcaster). It downloads a zipfile, unpacks and parses xml using elementtree and builds up a list of broadcasts. Im using pydev in eclipse for development and I'm running the addon on my windows 7 pc.
When the listing of broadcasts is requested in xbmc (12.1 Frodo) I get many "invalid handle" warnings in debug log. And in xbmc I don't get many items listed. Now I'm really confused.
What may be a reason for an invalid handle? I also tried searching google but did not find a solution for my problem.
From xbmc.log
my viewer class
I'm working on my first addon for xbmc (show online media from bavarian broadcaster). It downloads a zipfile, unpacks and parses xml using elementtree and builds up a list of broadcasts. Im using pydev in eclipse for development and I'm running the addon on my windows 7 pc.
When the listing of broadcasts is requested in xbmc (12.1 Frodo) I get many "invalid handle" warnings in debug log. And in xbmc I don't get many items listed. Now I'm really confused.
What may be a reason for an invalid handle? I also tried searching google but did not find a solution for my problem.
From xbmc.log
Quote:21:32:54 T:4744 DEBUG: Thread Background Loader 4744 terminating
21:32:55 T:4832 DEBUG: CApplication:rocessMouse: trying mouse action leftclick
21:32:55 T:4832 DEBUG: CGUIMediaWindow::GetDirectory (plugin://plugin.video.mediathek.br-online.de/?mediathek=Bayerischer%20Rundfunk)
21:32:55 T:4832 DEBUG: ParentPath = [plugin://plugin.video.mediathek.br-online.de/]
21:32:55 T:3724 DEBUG: XFILE::CPluginDirectory::StartScript - calling plugin Mediathek Bayerisches Fernsehen('plugin://plugin.video.mediathek.br-online.de/','43','?mediathek=Bayerischer%20Rundfunk')
21:32:55 T:3724 INFO: initializing python engine.
21:32:55 T:3724 DEBUG: new python thread created. id=43
21:32:55 T:3724 DEBUG: XFILE::CPluginDirectory::WaitOnScriptResult - waiting on the Mediathek Bayerisches Fernsehen (id=43) plugin...
21:32:55 T:4356 NOTICE: Thread XBPyThread start, auto delete: false
21:32:55 T:4356 DEBUG: Python thread: start processing
21:32:55 T:4356 NOTICE: -->Python Interpreter Initialized<--
21:32:55 T:4356 DEBUG: XBPyThread:rocess - The source file to load is C:\Program Files (x86)\XBMC\addons\plugin.video.mediathek_br_de\addon.py
21:32:55 T:4356 DEBUG: XBPyThread:rocess - Setting the Python path to C:\Program Files (x86)\XBMC\addons\plugin.video.mediathek_br_de;C:\Program Files (x86)\XBMC\addons\weather.wunderground\resources\lib\wunderground;C:\Program Files (x86)\XBMC\addons\script.module.simplejson\lib;C:\Program Files (x86)\XBMC\addons\script.module.pil\lib;C:\Program Files (x86)\XBMC\addons\script.module.pysqlite\lib;C:\Program Files (x86)\XBMC\system\python\DLLs;C:\Program Files (x86)\XBMC\system\python\Lib;C:\Program Files (x86)\XBMC\python26.zip;C:\Program Files (x86)\XBMC\system\python\lib\plat-win;C:\Program Files (x86)\XBMC\system\python\lib\lib-tk;C:\Program Files (x86)\XBMC;C:\Program Files (x86)\XBMC\system\python;C:\Program Files (x86)\XBMC\system\python\lib\site-packages;
21:32:55 T:4356 DEBUG: XBPyThread:rocess - Entering source directory C:\Program Files (x86)\XBMC\addons\plugin.video.mediathek_br_de
21:32:55 T:4356 DEBUG: Instantiating addon using automatically obtained id of "plugin.video.mediathek.br-online.de" dependent on version 1.0 of the xbmc.python api
21:32:55 T:4356 NOTICE: self.handle=43
21:32:55 T:4356 NOTICE: sys.argv[0]=plugin://plugin.video.mediathek.br-online.de/
21:32:55 T:4356 NOTICE: sys.argv[1]=43
21:32:55 T:4356 NOTICE: sys.argv[2]=?mediathek=Bayerischer%20Rundfunk
21:32:55 T:4832 DEBUG: ------ Window Init (DialogBusy.xml) ------
21:32:56 T:4356 NOTICE: items 120
21:32:56 T:3724 DEBUG: XFILE::CPluginDirectory::WaitOnScriptResult- plugin returned successfully
21:32:56 T:4356 NOTICE: addDirectoryItem(handle=43, url=plugin://plugin.video.mediathek.br-online.de/?mediathek=Bayerischer Rundfunk&sendungId=167, Zwischen Spessart und Karwendel, isFolder = True)
21:32:56 T:4356 WARNING: Attempt to use invalid handle 43
21:32:56 T:4356 WARNING: Previous line repeats 1 times.
21:32:56 T:4356 NOTICE: addDirectoryItem(handle=43, url=plugin://plugin.video.mediathek.br-online.de/?mediathek=Bayerischer Rundfunk&sendungId=3255, Einfach logisch, isFolder = True)
21:32:56 T:4356 WARNING: Attempt to use invalid handle 43
21:32:56 T:4356 WARNING: Previous line repeats 1 times.
21:32:56 T:4356 NOTICE: addDirectoryItem(handle=43, url=plugin://plugin.video.mediathek.br-online.de/?mediathek=Bayerischer Rundfunk&sendungId=199, Sturm der Liebe, isFolder = True)
21:32:56 T:4356 WARNING: Attempt to use invalid handle 43
21:32:56 T:4356 WARNING: Previous line repeats 1 times.
21:32:56 T:4356 NOTICE: addDirectoryItem(handle=43, url=plugin://plugin.video.mediathek.br-online.de/?mediathek=Bayerischer Rundfunk&sendungId=196, Rundschau-Magazin, isFolder = True)
21:32:56 T:4356 WARNING: Attempt to use invalid handle 43
21:32:56 T:4356 WARNING: Previous line repeats 1 times.
21:32:56 T:4356 NOTICE: addDirectoryItem(handle=43, url=plugin://plugin.video.mediathek.br-online.de/?mediathek=Bayerischer Rundfunk&sendungId=272, puzzle, isFolder = True)
21:32:56 T:4356 WARNING: Attempt to use invalid handle 43
21:32:56 T:4356 WARNING: Previous line repeats 1 times.
21:32:56 T:4356 NOTICE: addDirectoryItem(handle=43, url=plugin://plugin.video.mediathek.br-online.de/?mediathek=Bayerischer Rundfunk&sendungId=3143, Dahoam is Dahoam - Pannen aus Lansing, isFolder = True)
my viewer class
Code:
# -*- coding: utf-8 -*-
import sys, urllib, socket
from br import Br
import params
import xbmc, xbmcgui, xbmcplugin, xbmcaddon
class Viewer:
def __init__(self):
self.handle = int(sys.argv[1])
self.mediatheken = {}
def addMediathek(self, Mediathek):
self.mediatheken[Mediathek.getName()] = Mediathek
def getMediathek(self, mediathek):
return self.mediatheken[mediathek]
def listMediatheken(self):
for Mediathek in sorted(self.mediatheken.values()):
listItem = xbmcgui.ListItem(Mediathek.getName())
xbmcplugin.addDirectoryItem(handle = self.handle, url = '%s?mediathek=%s'
% (sys.argv[0], Mediathek.getName()),
listitem=listItem, isFolder=True)
xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE )
xbmcplugin.endOfDirectory(handle = self.handle)
def show(self, Mediathek):
items = Mediathek.show()
print "items " + str(len(items))
for item in items:
listItem = xbmcgui.ListItem(item.titel)
listItem.setInfo( type="Video", infoLabels={"Title": item.titel,
"Plot": item.plot,
"Sorttitle": item.titel } )
xbmcplugin.setResolvedUrl(handle = self.handle, succeeded=True, listitem=listItem)
if item.playable == True :
listItem.setProperty('IsPlayable', 'true')
print "addDirectoryItem(handle=" + str(self.handle) + ", url=%s" % (item.url) + ", " + item.titel + ", isFolder=False)"
xbmcplugin.addDirectoryItem(handle = self.handle, url = '%s' % (item.url),
listitem=listItem, isFolder=False)
else :
print "addDirectoryItem(handle=" + str(self.handle) + ", url=%s?mediathek=%s&%s" % ( sys.argv[0], Mediathek.getName(), item.url) + ", " + item.titel + ", isFolder = True)"
xbmcplugin.addDirectoryItem(handle = self.handle, url = '%s?mediathek=%s&%s'
% ( sys.argv[0], Mediathek.getName(), item.url),
listitem=listItem, isFolder=True)
xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE )
xbmcplugin.endOfDirectory(handle = self.handle)
def execute(self):
Params = params.Params()
lib = Params.get('mediathek')
if lib is not None:
lib = urllib.unquote_plus(lib);
Mediathek = self.getMediathek(lib)
self.show(Mediathek)
else:
self.listMediatheken()
socket.setdefaulttimeout(10);
Viewer = Viewer()
Viewer.addMediathek(Br())
Viewer.execute()