Can't get my AddLink proc to work

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
cavazorro Offline
Junior Member
Posts: 6
Joined: Mar 2012
Reputation: 0
Post: #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)
find quote
spiff Offline
Grumpy Bastard Developer
Posts: 12,234
Joined: Nov 2003
Reputation: 82
Post: #2
you can't use a random handle.

handle is passed in sys.argv(1)

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
cavazorro Offline
Junior Member
Posts: 6
Joined: Mar 2012
Reputation: 0
Post: #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
(This post was last modified: 2012-05-10 23:12 by cavazorro.)
find quote
spiff Offline
Grumpy Bastard Developer
Posts: 12,234
Joined: Nov 2003
Reputation: 82
Post: #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.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
cavazorro Offline
Junior Member
Posts: 6
Joined: Mar 2012
Reputation: 0
Post: #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.
find quote
spiff Offline
Grumpy Bastard Developer
Posts: 12,234
Joined: Nov 2003
Reputation: 82
Post: #6
how exactly are you launching the script?

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
cavazorro Offline
Junior Member
Posts: 6
Joined: Mar 2012
Reputation: 0
Post: #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.
find quote
cavazorro Offline
Junior Member
Posts: 6
Joined: Mar 2012
Reputation: 0
Post: #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!
find quote
Bstrdsmkr Offline
Fan
Posts: 711
Joined: Oct 2010
Reputation: 13
Post: #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
find quote
cavazorro Offline
Junior Member
Posts: 6
Joined: Mar 2012
Reputation: 0
Post: #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.
find quote