2011-07-14, 11:02
Hi
I have problem with handle addDir. I'm writting plugin to play streaming from few sites.
I've created default.py and write "addDir" def:
It's working when called to CATEGORIES:
The problem was when I tried use "addDir" inside first "addDir", for example: I have site weeb.tv and I enter in "CATEGORIES" to "Telewizja" it should display sites which I defined. When I had used "addDir" I got:
I have written new hosts files like weebtv.py and I defined new addDir to navigate. The problem was the same:
1. I entered to CATEGORIES - it's worked
2. From category I tried enter to host - it's not worked (still the same log "...invalid handle..")
The addDir in weebtv.py is:
I'd like show channels:
Display this channels:
The log in xbmc is:
I've been searching solution this problem but I didn't.
Could anyone explain to me how its works? How can I use "addDir" inside another "addDir"?
Plesken
PS. I hope my explanation is clear, if not ask me.
I have problem with handle addDir. I'm writting plugin to play streaming from few sites.
I've created default.py and write "addDir" def:
Code:
def addDir(self, name, mode, autoplay, isPlayable = True):
u=sys.argv[0] + "?mode=" + str(mode)
log.info(u)
icon = "DefaultVideoPlaylists.png"
if autoplay:
icon= "DefaultVideo.png"
liz=xbmcgui.ListItem(name, iconImage=icon, thumbnailImage='')
if autoplay and isPlayable:
liz.setProperty("IsPlayable", "true")
liz.setInfo( type="Video", infoLabels={ "Title": name } )
log.info(name)
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u,listitem=liz, isFolder= not autoplay)
It's working when called to CATEGORIES:
Code:
def CATEGORIES(self):
self.addDir("Telewizja", 1, True, False)
self.addDir("Filmy, Seriale", 2, True, False)
self.addDir('Ustawienia', 20, True, False)
xbmcplugin.endOfDirectory(int(sys.argv[1]))
The problem was when I tried use "addDir" inside first "addDir", for example: I have site weeb.tv and I enter in "CATEGORIES" to "Telewizja" it should display sites which I defined. When I had used "addDir" I got:
Code:
10:33:39 T:2829572976 M:2229342208 ERROR: AddItem - called with an invalid handle.
10:33:39 T:2829572976 M:2229342208 ERROR: EndOfDirectory - called with an invalid handle.
I have written new hosts files like weebtv.py and I defined new addDir to navigate. The problem was the same:
1. I entered to CATEGORIES - it's worked
2. From category I tried enter to host - it's not worked (still the same log "...invalid handle..")
The addDir in weebtv.py is:
Code:
def addDir(self, name, iconimage):
#u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)
u=sys.argv[0]+"?name="+urllib.quote_plus(name)
log.info(str(u))
ok=True
liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": name } )
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
return ok
I'd like show channels:
Code:
def getChannelNamesAddDir(self):
origTab = self.getChannels()
for i in range(len(origTab)):
value = origTab[i]
name = value[1]
iconimage = value[2]
self.addDir(name, iconimage)
xbmcplugin.endOfDirectory(int(sys.argv[1]))
Display this channels:
Code:
def handle(self):
channel = self.getChannelNamesAddDir()
log.info(str(channel))
def handleService(self):
log.info('Wejście do TV komercyjnej')
self.handle()
The log in xbmc is:
Code:
10:33:38 T:2829572976 M:2229194752 NOTICE: [Polish Live TV 1] Wejście do TV komercyjnej
10:33:39 T:2829572976 M:2229342208 NOTICE: [Polish Live TV 1] plugin://plugin.video.polishtv.live/?name=TVN24
10:33:39 T:2829572976 M:2229342208 ERROR: AddItem - called with an invalid handle.
10:33:39 T:2829572976 M:2229342208 NOTICE: [Polish Live TV 1] plugin://plugin.video.polishtv.live/?name=TVN
10:33:39 T:2829572976 M:2229342208 ERROR: AddItem - called with an invalid handle.
10:33:39 T:2829572976 M:2229342208 NOTICE: [Polish Live TV 1] plugin://plugin.video.polishtv.live/?name=Polsat
10:33:39 T:2829572976 M:2229342208 ERROR: AddItem - called with an invalid handle.
10:33:39 T:2829572976 M:2229342208 NOTICE: [Polish Live TV 1] plugin://plugin.video.polishtv.live/?name=TVP2
10:33:39 T:2829572976 M:2229342208 ERROR: AddItem - called with an invalid handle.
10:33:39 T:2829572976 M:2229342208 NOTICE: [Polish Live TV 1] plugin://plugin.video.polishtv.live/?name=Discovery+Channel
10:33:39 T:2829572976 M:2229342208 ERROR: AddItem - called with an invalid handle.
10:33:39 T:2829572976 M:2229342208 NOTICE: [Polish Live TV 1] plugin://plugin.video.polishtv.live/?name=NationalGeo
10:33:39 T:2829572976 M:2229342208 ERROR: AddItem - called with an invalid handle.
I've been searching solution this problem but I didn't.
Could anyone explain to me how its works? How can I use "addDir" inside another "addDir"?
Plesken
PS. I hope my explanation is clear, if not ask me.