addDirectoryItem doesn't update the list

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
jhsrennie Offline
Team-XBMC Developer
Posts: 7,236
Joined: Nov 2008
Reputation: 119
Location: Chester, UK
Post: #1
I have the following test addon:

Code:
import xbmcplugin
import xbmcgui

_thisPlugin = int(sys.argv[1])
_thisPluginName = "plugin.script.test"

cmd = sys.argv[2].replace("?", "")

if cmd == "test":
    xbmcgui.Dialog().ok("Test", "You selected the test option")
    listItem = xbmcgui.ListItem("You selected the test option")
    xbmcplugin.addDirectoryItem(_thisPlugin,"plugin://plugin.script.test", listItem)

else:
    listItem = xbmcgui.ListItem("The test option")
    xbmcplugin.addDirectoryItem(_thisPlugin,"plugin://plugin.script.test?test", listItem)

xbmcplugin.endOfDirectory(_thisPlugin)

When I go into it it lists one item "The test option" just as I'd expect. However when I select the test option it does not update the list. It does display the dialog, so I know it correctly parsed the argument, "test", and executed the code:

Code:
listItem = xbmcgui.ListItem("You selected the test option")
    xbmcplugin.addDirectoryItem(_thisPlugin,"plugin://plugin.script.test", listItem)

but the list displayed didn't change i.e. it didn't show "You selected the test option". Do I have to do something to reset the list once I've entered the plugin so I can update it?

JR
find quote
ppic Offline
Skilled Python Coder
Posts: 2,711
Joined: Feb 2009
Reputation: 11
Location: France idf
Post: #2
see container.update or container.refresh

[Image: widget]
Passion-XBMC Repository Download your SVN skins and addons
TvTunes Addon Download Play your theme while browsing library
TVshow Next Aired display next aired infos from tvrage.com
Logo Downloader Script download Logo/clearart/show thumbs/poster/banner
Bande-Annonce Allociné plugin watch trailers in french and vo
SportLive Script Live score match info in XBMC (not compatible dharma)
find quote
jhsrennie Offline
Team-XBMC Developer
Posts: 7,236
Joined: Nov 2008
Reputation: 119
Location: Chester, UK
Post: #3
Thanks, could you give me a quick example of this would work with my test code. As far as I can see none of xbmc, xbmcgui, xbmcplugin or xbmcaddon have .update or .refresh methods. Or is there an XBMC object called "container"?

JR
find quote
ppic Offline
Skilled Python Coder
Posts: 2,711
Joined: Feb 2009
Reputation: 11
Location: France idf
Post: #4
Code:
if mode == 7: #suppression cinema perso
    delete_cinema( (url, name ))
    xbmc.executebuiltin("Container.Refresh")
    OK=False

closer look:
http://code.google.com/p/passion-xbmc/so...default.py

[Image: widget]
Passion-XBMC Repository Download your SVN skins and addons
TvTunes Addon Download Play your theme while browsing library
TVshow Next Aired display next aired infos from tvrage.com
Logo Downloader Script download Logo/clearart/show thumbs/poster/banner
Bande-Annonce Allociné plugin watch trailers in french and vo
SportLive Script Live score match info in XBMC (not compatible dharma)
(This post was last modified: 2010-10-05 17:42 by ppic.)
find quote
jhsrennie Offline
Team-XBMC Developer
Posts: 7,236
Joined: Nov 2008
Reputation: 119
Location: Chester, UK
Post: #5
Thanks, I tried:

Code:
import xbmcplugin
import xbmcgui

_thisPlugin = int(sys.argv[1])
_thisPluginName = "plugin.script.test"

cmd = sys.argv[2].replace("?", "")

if cmd == "test":
    xbmc.executebuiltin("Container.Refresh")
    xbmcgui.Dialog().ok("Test", "You selected the test option")
    listItem = xbmcgui.ListItem("You selected the test option")
    xbmcplugin.addDirectoryItem(_thisPlugin,"plugin://plugin.script.test", listItem)
    xbmcplugin.endOfDirectory(_thisPlugin, updateListing=True)
    xbmc.executebuiltin("Container.Refresh")

else:
    listItem = xbmcgui.ListItem("The test option")
    xbmcplugin.addDirectoryItem(_thisPlugin,"plugin://plugin.script.test?test", listItem)
    xbmcplugin.endOfDirectory(_thisPlugin, updateListing=True)
and it made no difference. The list still didn't refresh when I selected the test option from the first listing.

JR
find quote
ppic Offline
Skilled Python Coder
Posts: 2,711
Joined: Feb 2009
Reputation: 11
Location: France idf
Post: #6
well, i need to see later, i'm at work actually.

[Image: widget]
Passion-XBMC Repository Download your SVN skins and addons
TvTunes Addon Download Play your theme while browsing library
TVshow Next Aired display next aired infos from tvrage.com
Logo Downloader Script download Logo/clearart/show thumbs/poster/banner
Bande-Annonce Allociné plugin watch trailers in french and vo
SportLive Script Live score match info in XBMC (not compatible dharma)
find quote
jhsrennie Offline
Team-XBMC Developer
Posts: 7,236
Joined: Nov 2008
Reputation: 119
Location: Chester, UK
Post: #7
ppic Wrote:well, i need to see later, i'm at work actually.

Thanks for your help. I'm sure there's something obvious I'm missing.

JR
find quote
ppic Offline
Skilled Python Coder
Posts: 2,711
Joined: Feb 2009
Reputation: 11
Location: France idf
Post: #8
can you provide zipped version of the test plugin?

[Image: widget]
Passion-XBMC Repository Download your SVN skins and addons
TvTunes Addon Download Play your theme while browsing library
TVshow Next Aired display next aired infos from tvrage.com
Logo Downloader Script download Logo/clearart/show thumbs/poster/banner
Bande-Annonce Allociné plugin watch trailers in french and vo
SportLive Script Live score match info in XBMC (not compatible dharma)
find quote
jhsrennie Offline
Team-XBMC Developer
Posts: 7,236
Joined: Nov 2008
Reputation: 119
Location: Chester, UK
Post: #9
ppic Wrote:can you provide zipped version of the test plugin?

http://swarchive.ratsauce.co.uk/plugin_test.zip

Thanks, JR
find quote