Refreshing lists in a plugin?
#1
Is it possible to load/reload a list without adding history to it? Basically I want:

1) Load a list containing x items
Image

2)On clicking an item be shown some actions
Image

3) Upon pressing the action reload the original list.

I've tried having #3 load the plugin (Using RunScript()) with the correct arguments and use the previous handle (from #1), but that does not work due to an 'invalid handle' (I'm probably misunderstanding the purpose of the handle).

What I'm most concerned about is not adding history to the view, so doing 4 deletes would not mean I would need to go back 4 times to get to the main screen.

Can anyone help? If you need code you can see item_list.py and sabnzbd_add.py here
Reply
#2
You can call a built in function Container.Refresh (I think it is) to refresh the list - this may be what you want?

EDIT: Or see the docs:

Code:
PyDoc_STRVAR(endOfDirectory__doc__,
    "endOfDirectory(handle[, succeeded, updateListing, cacheToDisc]) -- Callback function to tell XBMC that the end of the directory listing in a virtualPythonFolder module is reached.\n"
    "\n"
    "handle           : integer - handle the plugin was started with.\n"
    "succeeded        : [opt] bool - True=script completed successfully(Default)/False=Script did not.\n"
    "updateListing    : [opt] bool - True=this folder should update the current listing/False=Folder is a subfolder(Default).\n"
    "cacheToDisc      : [opt] bool - True=Folder will cache if extended time(default)/False=this folder will never cache to disc.\n"
    "\n"
    "*Note, You can use the above as keywords for arguments and skip certain optional arguments.\n"
    "       Once you use a keyword, all following arguments require the keyword.\n"
    "\n"
    "example:\n"
    "  - xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False)\n");

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
Thanks for responding Jonathan.

I couldn't get updateListings to work due to 'handle' issues, however Container.Refresh worked perfectly Big Grin. I didn't see it listed in the wiki but should have had a look at the actual source.
Reply
#4
So Container.Refresh doesn't seem to work any longer in the new revs of XBMC. I have a modified version of this plugin that works with the new addon system, thanks to Amet.

addon version

After an action is given to the SAB queue as seen in sw1tch's images above, the list is not refreshed.

Using the pre-addon version of the script with XBMC rev 28265 the list refreshes properly.

Original pre-addon version.
Reply
#5
Seems to me it's refreshing the list just fine. What is not working is that Delete etc. aren't actually deleting anything in the SABnzbd list. The only one that I got to actually do something was Pause All and Resume All.

Note you can tell the refresh of the list is working, as you can:

1. List in XBMC.
2. Change order in SABnzbd via the webinterface.
3. Click on something in XBMC and choose something like "Delete" or "Move to top".

List will refresh, but the action you chose isn't taken. I'm using SABnzbd 0.4.12.

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
#6
The actions were updated for SAB .5.0 and above. Delete and move seem to only work if you have a username and password set in SAB and the plugin. I had been moving and deleting items for 4 hours this morning from the plugin. Each time the queue was changed properly in the SAB interface but the list in XBMC never changed. Amet also looked at it with me and experienced the same results.

I'd be happy to let you connect to my SAB server if need be.

I'll test your process and see what happens.
Reply
#7
Ok - thanks. I managed to reproduce. The problem is it depends on how long it takes to retrieve the list. Fast retrieval -> no problem. Slower retrieval -> listing is cached.

EDIT: fixed in r31198. Still doesn't work with 0.4.12

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
#8
Great. Thanks. I think under .5 the commands were either issued differently or did not support move and delete.

I'll try it out tonight with a new build.
Reply
#9
I got time to try it out already. Works perfectly again. Thanks JM.

So why would it work on pre-addon builds? Was there a change somewhere in SVN, or was it merely because the pre-addon version I was testing was on the same PC as the SAB server so response times were faster?
Reply

Logout Mark Read Team Forum Stats Members Help
Refreshing lists in a plugin?0