Posts: 14
Joined: Oct 2012
Reputation:
0
derolf
Junior Member
Posts: 14
2012-11-01, 12:38
(This post was last modified: 2012-11-01, 12:44 by derolf.)
Hi,
at the moment, I load the whole directory at once, which might take a while.
is it possible to fill the directory incrementally, without blocking the GUI? (Kind of background thread that fills the directory)
I guess that I can launch a pyhton thread to do the background work, so can I notify the GUI to reload the directory from my addon?
dero
Posts: 1,299
Joined: Jul 2009
Reputation:
59
sphere
Retired Team-Kodi Member
Posts: 1,299
I guess you are talking about a add-on of type "plugin", correct?
In plugins you can't add listitems asynchronous.
There are design-workarounds like using a pagination or using parent-folders for separate initials.
You could also show your code - maybe we can find a solution.
Posts: 14
Joined: Oct 2012
Reputation:
0
derolf
Junior Member
Posts: 14
Yes, I am talking about a video plugin.
I build the list from many REST calls.
I guess I could spawn a thread to do this and then fill the directory from the current state of the background fetcher's results.
Is it possible to trigger a directory reload?
dero
Posts: 793
Joined: Oct 2010
Reputation:
17
The thread will run until completion. You need to design your plugin with this in mind so that you don't deadlock Xbmc when it tries to exit but has to wait for a thread to finish. A common method is to have the child thread check Xbmc.abortrequested() before doing anything and exit if it's true.
Posts: 14
Joined: Oct 2012
Reputation:
0
derolf
Junior Member
Posts: 14
2012-11-01, 17:08
(This post was last modified: 2012-11-01, 17:08 by derolf.)
Okay, so basically it's supported what I want... THANKS!