Python help needed if anyone has any ideas

Don't know if there are any python ninjas that could help, basically im trying to get on deck / recently added working on XBMC through plexbmc, we have changed the code to use /library/sections/sectionid/onDeck(or recentlyAdded) instead of the aggregated /library/onDeck(or recentlyAdded), which brought up some limitations, basically the skin would need to have declarations for each possible item, so if someone had 20 sections and it was bringing back 25 items per section, the skin would need to account for 500 items, I have now changed that to dynamically list the items, the problem with that is the path declaration in listitem is different from the onclick tag in a skin, so in the skin:

 

[onclick] PlayMedia(plugin://plugin.video.plexbmc?url=http://192.168.0.20:32400/library/metadata/21995&mode=11&t=7260639398) [/onclick]

 

that works fine, but now I am creating them dynamically:

def add_listitem(item, thumb, path_to_play):    listitem = xbmcgui.ListItem('%s %s - %s' %(item.get('title','Unknown').encode('UTF-8'),item.get('year','Unknown').encode('UTF-8'), item.get('rating','Unknown').encode('UTF-8')), thumbnailImage=thumb, path=path_to_play)
    return listitem
From what I have read, you can't pass PlayMedia as part of the path, and would have to call the plugin itself to initiate the playmedia, ive tried the following:
 
[plugin://plugin.video.plexbmc?playtype=video&url=http://192.168.0.20:32400/library/metadata/21995&mode=11&t=7260639398]
 
and then in the plugin
 
try:
    params=get_params(sys.argv[2])
except:
    params={}
 
playtype_url=params.get('playtype',None)
 
if playtype_url:
    printDebug("hit playtype: %s" % playtype_url )
    url=params.get('url',None)
    mode=params.get('mode',None)
    t=params.get('t',None)
    pluginPlay(playtype_url, url, mode, t)
 
def pluginPlay(playtype, url, mode, t):
    printDebug("hit pluginPlay: %s %s %s %s" %(playtype, url, mode, t) )
    if(playtype == "video"):
        PlayMedia(do the stuff here editor keeps stripping the line though)
 

But I'm doing something wrong because thats not working either, it doesn't even get to the first printDebug

 

Anyone have any ideas?

 

*edit* the above isn't totally accurate, the editor kept stripping bits out but you should get the gist, if you need to see the code exactly as it is it here: https://github.com/KodeStar/plugin.video.plexbmc/tree/dynamic-listitems

I was in the process of doing something similar…
What I’m planned to do is utilize my already setup XML Parser in Python.
You need then extract all of the key="" from this http : // 192.168.X.X:32400/library/sections/
Dump it into and array, or use it on the fly through a for loop.
Hopefully that helps point you in the right direction…
Let me know if you have any further questions.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.