ListItem displays plugin name as label, ignores setLabel
#1
I'm trying to create a list in my test plugin and I cant get listItem to display the desired label. It displays the name of the plugin as my label for all my items, even when I use static label text

My code is as below

Code:
li=xbmcgui.ListItem( label='Test')
li.setInfo( type="Video", infoLabels={ "Title": name } )
u=sys.argv[0]+"?mode=3&name="+urllib.quote_plus(name)+"&url="+urllib.quote_plus(URLS[x])
ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=li, isFolder=False)

Instead of displaying "Test" for listItem label it displays the name of my plugin

Anybody got an idea why?
Reply
#2
Which version of XBMC, as this was fixed a while back, but it keeps popping up (i.e. there's something you're doing differently than other plugins).

If it's a recent SVN build, then I'll need a trac ticket (there probably already is one - have a search and let me know if there is) with an example plugin attached.

Cheers,
Jonathan
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.


Image
Reply
#3
jmarshall Wrote:Which version of XBMC, as this was fixed a while back, but it keeps popping up (i.e. there's something you're doing differently than other plugins).

If it's a recent SVN build, then I'll need a trac ticket (there probably already is one - have a search and let me know if there is) with an example plugin attached.

Cheers,
Jonathan

Apologies for the late reply

I was using Windows Rev21496
I went back and tested on Babylon Beta1 and 9.04.1(repack2)

All have the same result

I couldn't find a trac ticket. I'll see if I can get the script down to its barebones and open a new ticket
Reply
#4
I have created a Ticket #6898. Here is the code here as well

Code:
#PLUGIN NAME: KidsTube
#VERSION: 0.01
#DATE: 5 July 2009
#AUTHOR: Chuckles


import xbmc, xbmcgui, xbmcplugin, urllib2, urllib, re, string

def showList(url,page):
        thisurl=url
        f=urllib2.urlopen(url)
        a=f.read()
        f.close()
        p=re.compile('<li><a href="(.+?)"><img src="(.+?)" alt="video pic" border="0" class="IndexVideoDetails_Thumb" />')
        o=re.compile('<span class="font4_14-1">(.+?)</span>')
        match=p.findall(a)
        NAMES=o.findall(a)
        x=0
        for rel_url, name in match:
          li=xbmcgui.ListItem("Test")
          #li=xbmcgui.ListItem(NAMES[x])
          li.setInfo( type="Video", infoLabels={ "Title": NAMES[x] } )
          u=sys.argv[0]+"?mode=3&name="+urllib.quote_plus(NAMES[x])+"&url="+urllib.quote_plus(rel_url)
          ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=li)
          x=x+1

url=urllib.unquote_plus("http://www.kidstube.com/")
page=1

showList(url,page)

xbmcplugin.endOfDirectory(int(sys.argv[1]))
Reply
#5
Code:
#PLUGIN NAME: KidsTube
#VERSION: 0.01
#DATE: 5 July 2009
#AUTHOR: Chuckles


import xbmc, xbmcgui, xbmcplugin, urllib2, urllib, re, string

def showList(url,page):
        thisurl=url
        f=urllib2.urlopen(url)
        a=f.read()
        f.close()
        p=re.compile('<li><a href="(.+?)"><img src="(.+?)" alt="video pic" border="0" class="IndexVideoDetails_Thumb" />')
        o=re.compile('<span class="font4_14-1">(.+?)</span>')
        match=p.findall(a)
        NAMES=o.findall(a)
        x=0
        for rel_url, name in match:
          li=xbmcgui.ListItem("Test")
          #li=xbmcgui.ListItem(NAMES[x])
          li.setInfo( type="Video", infoLabels={ "Title": NAMES[x] } )
          u=sys.argv[0]+"?mode=3&name="+urllib.quote_plus(NAMES[x])+"&url="+urllib.quote_plus(rel_url)
          ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=li)
          x=x+1

url=urllib.unquote_plus("http://www.kidstube.com/")
page=1

showList(url,page)

[b]xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_LABEL )[/b]
xbmcplugin.endOfDirectory(int(sys.argv[1]))

You need to add a sortmethod. I added to your code above...
Reply
#6
So with the sort method added you don't get the problem?

Cheers,
Jonathan
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.


Image
Reply
#7
jmarshall Wrote:So with the sort method added you don't get the problem?

Cheers,
Jonathan

I'm not sure if it works with all methods, but SORT_METHOD_LABEL seems to fix the problem.


edit...I also tried SORT_METHOD_DATE and that works too. So I guess any sort method would fix the problem.
Reply
#8
Interesting. Will see if I can figure out why this is necessary.
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.


Image
Reply
#9
stacked Wrote:You need to add a sortmethod. I added to your code above...


I can confirm that this works. Thanks!!!
Reply
#10
FYI, r21647 will return a proper listing if there's no sortmethod set.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply

Logout Mark Read Team Forum Stats Members Help
ListItem displays plugin name as label, ignores setLabel0