2010-12-30, 22:21
I've been using a video plugin for a while that makes use of the setResolvedUrl functionality to deal with a time-limited URL token. In this case, one video consists of multiple clips, where each clip uses setResolvedUrl. Rather than forcing the user to click on each clip to play it, I construct and populate a playlist (in script), where each entry would use the setResolvedUrl functionality. I then proceed to play that playlist automatically from my script. Here's a snippet:
The problem I have is that attempting to play a playlist (containing python plugin entries) means that a python script is calling xbmc which is then calling that same python script. This causes problems for the python interpreter which has a mutex to keep it from re-entering itself in this manner. Because I settled on using the xbmc.executebuiltin('playlist.playoffset(video,0)') function, it will sometimes work, sometimes not, depending on how quickly the playlist starts playing and how quickly my plugin shuts down.
I'm hoping a dev has a suggestion for a way to make this work. As you can see from the many commented out lines of code above, I tried to create a STRM file and play that, but it wasn't successful.
Code:
# enumerate thru the item list and gather info
i = 1
for item in items:
clipItem = self.ParseClipItem(item)
#clipURL = self.ClipItemToFinalClipURL(clipItem['ClipId'])
linkDesc = CTVEnumerator.SelfLinkDesc(self)
linkDesc.Name = self.unescape(clipItem['Title'])
linkDesc.ClipId = clipItem['ClipId']
linkDesc.Mode = 'PlayClip'
linkDesc.IconImage = self.unescape(clipItem['Thumbnail'])
linkDesc.Plot = self.unescape(clipItem['Description'])
linkDesc.nOrder = i
#episodeStrmFile.write(linkDesc.ToURLString() + "\n")
#print linkDesc.ToURLString()
liz = self.addCTVRedirectorLink(linkDesc)
objPL.add(url=linkDesc.ToURLString(),listitem=liz)
i=i+1
#episodeStrmFile.close()
##liz=xbmcgui.ListItem("Full Episode", iconImage="DefaultVideo.png", path=episodeStrmFileName)
##liz.setProperty("IsPlayable", "true")
##xbmc.Player().play(item=episodeStrmFileName,listitem=liz)
xbmc.executebuiltin('playlist.playoffset(video,0)')
#print ("Episode stream file: %s"%episodeStrmFileName)
The problem I have is that attempting to play a playlist (containing python plugin entries) means that a python script is calling xbmc which is then calling that same python script. This causes problems for the python interpreter which has a mutex to keep it from re-entering itself in this manner. Because I settled on using the xbmc.executebuiltin('playlist.playoffset(video,0)') function, it will sometimes work, sometimes not, depending on how quickly the playlist starts playing and how quickly my plugin shuts down.
I'm hoping a dev has a suggestion for a way to make this work. As you can see from the many commented out lines of code above, I tried to create a STRM file and play that, but it wasn't successful.