this is what is use for the context items (to add/remove queue items from netflix), curX is the object that has the info label data for the movie/show.
When i add the item to the directory list, it's already got the context menu item associated with it
Code:
def addLink(name,url,curX,rootID=None):
ok=True
liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=curX.Poster)
#if(xSummary):
liz.setInfo( type="Video", infoLabels={ "Mpaa": curX.Mpaa, "TrackNumber": int(curX.Position), "Year": int(curX.Year), "OriginalTitle": curX.Title, "Title": curX.TitleShort, "Rating": float(curX.Rating)*2, "Duration": str(int(curX.Runtime)/60), "Director": curX.Directors, "Genre": curX.Genres, "CastAndRole": curX.Cast, "Plot": curX.Synop })
commands = []
argsRemove = str(curX.ID) + "delete"
argsAdd = str(curX.ID) + "post"
argsSimilar = str(curX.ID)
if rootID:
argsRemove = str(rootID) + "delete"
argsAdd = str(rootID) + "post"
argsSimilar = str(rootID)
runnerRemove = "XBMC.RunScript(special://home/addons/plugin.video.xbmcflicks/resources/lib/modQueue.py, " + argsRemove + ")"
runnerAdd = "XBMC.RunScript(special://home/addons/plugin.video.xbmcflicks/resources/lib/modQueue.py, " + argsAdd + ")"
runnerSearch = "XBMC.RunScript(special://home/addons/plugin.video.xbmcflicks/resources/lib/modQueue.py, " + argsSimilar + ")"
if(not curX.TvEpisode):
commands.append(( 'Netflix: Add to Instant Queue', runnerAdd, ))
commands.append(( 'Netflix: Remove From Instant Queue', runnerRemove, ))
#commands.append(( 'Netflix: Find Similar', runnerSearch, ))
else:
commands.append(( 'Netflix: Add Entire Season to Instant Queue', runnerAdd, ))
commands.append(( 'Netflix: Remove Entire Season From Instant Queue', runnerRemove, ))
liz.addContextMenuItems( commands )
whichHandler = sys.argv[1]
ok=xbmcplugin.addDirectoryItem(handle=int(whichHandler),url=url,listitem=liz, isFolder=False)
return ok