ListItem fromString and offscreen=True
#1
I have been revisiting an old addon I was working on and had some issues with ListItems being slow to create on slow machines like Pi2 etc
The problem was as soon as I called any of the setProp or setInfo function on the ListItems it was very slow, about 10 times slower than not setting any info.
My theory on this is variable marshaling between the Python and C++ interface but I am not sure.

Anyway I was then looking though the latest Kodi 17 python doscs and noticed this
https://codedocs.xyz/AlwinEsch/kodi/grou...3e6a097bd6

does this mean I can create a ListItem object from a string? If so how? Is there any docs on using this? As you can see from the above there are no examples and I can not find anything that shows how to use this.
Reply
#2
Also how can I create a ListItem in offscreen=True mode

I tryed the following:

list = xbmcgui.ListItem(listItemName, iconImage=thumbPath, thumbnailImage=thumbPath, offscreen=True)

But I get this error

TypeError: 'offscreen' is an invalid keyword argument for this function
Reply
#3
I think I can answer my own question here, offscreen is not available yet available.

It was added in the following commit:
https://github.com/xbmc/xbmc/commit/7c99...b5fba052f7

This is in main, does this mean it is available in Leia?
Reply
#4
the slow creation of listitems is fixed in master (Leia):
https://github.com/xbmc/xbmc/pull/11651

and will be fixed in the upcoming 17.1 release as well:
https://github.com/xbmc/xbmc/pull/11660


the 'offscreen' arg is only available in master indeed, it was added specifically for python based scrapers,
i'm not sure if it can/should be used by other types of addons as well.

there's no documentation for the fromString() method. i believe is should be used like this:
Code:
listitem = xbmcgui.ListItem().fromString('Hello World')
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#5
thank for confirming that.

You mentioned Python based scrappers.
The addon I am working on goes out to a media server and gets a list of movies from a web api and then builds ListItems to show these movies in Kodi. Would this be considered a scrapper?
Reply
#6
nope, i was referring to our metadata scrapers... the one you use when you scan your media to the library.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#7
I just had a play with OSMC Kodi 18 and the offscreen=True option, when creating ListItem objects this significantly speeds up creating many items 200+ for display.

Initial tests went from 15 seconds to load and create 450 items down to about 2 seconds on my test RPi2 with just one line change.
Reply
#8
as you can read in the commit you linked to, offscreen should only be set to True for listitems that are not going to be displayed ;-)
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#9
not on the screen now or never going to be on the screen?
From what I can see in the source if you are building this item to be eventually shown on the screen that should be ok.
Reply
#10
never ever Smile
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#11
why is this?
If the ListItem is not on the screen currently why does it need a GUI lock when you set data in it?
Reply
#12
if i could give an accurate answer i would :-)

perhaps someone with a better understanding of GUI locking can chime in?
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#13
I would like to go deeper on this and find out if this is a valid use of the offscreen param.
If I can create a bunch of ListItems offscreen and then return them in the addon it can speed it up by a factor of 10.
If this is not valid and might stop working in a future update then I wont bother.

Anyone care to comment?
Reply
#14
That is the intended use. The gui is uselessly locked in most cases. as long as the item do not sit in a onscreen container this should be set. I just couldnt change the default as that would break legacy code depending on it.

History is that originally listitems were always backed by a container item but the bindings are now used for much more than building windows. It made sense a long time ago.
Reply
#15
excellent, thanks for confirming.

any change of getting this pull request into 17.1?
Reply

Logout Mark Read Team Forum Stats Members Help
ListItem fromString and offscreen=True0