Can't get my AddLink proc to work
#1
This is the second addon I develop, the other one went ok and now it seems I can't get things to work for some reason. I'm trying to list a series of pictures and let the user select the picture and display them using the regular slideshow player from XBMC. I'm able to show the link but it doesn't don't work (nothing happens when clicked) and nothing in the form of an ERROR comes up in the log. I've removed all functionality from the code to the point where I'm just adding one link to a picture in the local drive, and it still won't work. ANY HELP will be GREATLY appreciated.

Here's the simplified code:

import urllib,urllib2,re,xbmcplugin,xbmcgui
from xml.dom import minidom
import subprocess
import xbmcaddon

liz=xbmcgui.ListItem("Link", "", "")
liz.setInfo( type="Pictures", infoLabels={ "Title":"Photo"} )
xbmcplugin.addDirectoryItem(handle=0,url="C:\\1_616140.jpg",listitem=liz,isFolder=False)
xbmcplugin.endOfDirectory(0)
Reply
#2
you can't use a random handle.

handle is passed in sys.argv(1)
Reply
#3
Yes, I removed it to see if it made a difference but it didn't. I've put it back but still doesn't work:

import urllib,urllib2,re,xbmcplugin,xbmcgui
import simplejson
from xml.dom import minidom
import subprocess
import xbmcaddon

def get_params():
param=[]
paramstring=sys.argv[2]
if len(paramstring)>=2:
params=sys.argv[2]
cleanedparams=params.replace('?','')
if (params[len(params)-1]=='/'):
params=params[0:len(params)-2]
pairsofparams=cleanedparams.split('&')
param={}
for i in range(len(pairsofparams)):
splitparams={}
splitparams=pairsofparams[i].split('=')
if (len(splitparams))==2:
param[splitparams[0]]=splitparams[1]

return param

liz=xbmcgui.ListItem("Link", "", "")
liz.setInfo( type="Pictures", infoLabels={ "Title":"David"} )
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url="C:\\1_616140.jpg",listitem=liz,isFolder=False)
xbmcplugin.endOfDirectory(int(sys.argv[1]))
Code in pastebin: http://pastebin.com/qZMt4sP8
Reply
#4
it works just fine for me (replacing the image url with one valid at my box). oh, and NEVER inline code. whenever somebody search for e.g. xbmcplugin they will get your useless snippet.
Reply
#5
Thanks spiff, sorry about the inline code, I was just desperate and wanted to remove as many variables as possible. There must be something wrong with my setup, I see no reason why it should fail. I'll try reinstalling XBMC to see if it makes a difference. I tried with different files (videos, images) and none of them play. There are no errors in the log. I'll reinstall and report here. Thanks again.
Reply
#6
how exactly are you launching the script?
Reply
#7
I've reinstalled XBMC hoping there was something wrong with the application but still doesn't work. Rest of addons work fine.

Here's the log: http://pastebin.com/7k1gBGRg

I couldn't see any significant errors. It seems like the python interpreter is not liking something but won't return an error.

Reply
#8
(2012-05-11, 17:16)spiff Wrote: how exactly are you launching the script?

I'm just putting the default.py file in the addon folder and running it in XBMC. The link shows fine but when I click on it and try to launch the picture (or video for that matter), nothing happens. Should I try to launch it differently?

THANKS FOR ALL YOUR HELP!
Reply
#9
Quote:10:33:00 T:2836 DEBUG: Instantiating addon using automatically obtained id of "plugin.dh.resultados" dependent on version 1.0 of the xbmc.python api

Set your python version to 2.0 in addon.xml
Also, it looks like it can't stat any of these images. Double check first that they exist in that location and second that their permissions are set appropriately
Reply
#10
FINALLY!!!

Thanks for pointing me to the addon.xml file. I had used the addon file from my previous plugin where I had the provides tag set to "executable". I thought this was only for telling xmbc where to place the application in the navigation menu. I changed it to "image" and voila, it's working. I had also changed the python version to 2.0 but that by itself didn't fix it. Now with 2.0 and the <provides> tag set to "image" it seems to be working. I wasted many hours on these, but hey, that's why programming is never linear.

Reply

Logout Mark Read Team Forum Stats Members Help
Can't get my AddLink proc to work0