ListItemAbsolute(0).Label broken?
#1
Hello,

I want to get the *first* item of a list.

I'm trying to do this with "ListItemAbsolute(0).Label".

This InfoLabel works for all items but the first. As soon as I pass "0" as the Index, I always get the selected item and not the absolute first item.

Is this a known bug? Is there any workaround to get the *first* item?
Reply
#2
can't reproduce, it's working fine here.

a link to the code you're working on might make it easier for us to spot if there's an error in your code ;-)
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
#3
Did you check with latest Kodi 16?

I did a hack now by using the current position to use the relative indexing. This works but is a bit ugly...
Reply
#4
could you test:
Code:
Container(id).ListItemAbsolute(0).Label
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
I have no container ID. Can I just use your string as it is?
Reply
#6
nope, you'll need the id of the container, eg:
Container(9000).ListItemAbsolute(0).Label
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
Is it possible to request the current id?
Reply
#8
sure: http://mirrors.xbmc.org/docs/python-docs...getFocusId
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
This works. I can just keep the "id" empty (documentation says that the current container is used in this case).

But there is one problem with this.

If I choose "Music -> Files" from main menu, then I end in a list which is said to have (in my case) one item but in fact there are two (the first item shows "..").

If I request the absolute first item (0), then I get the item with the ".." in it.

I use the following Info Labels to get the current selected index and the count of items:

osdCurrentItemIndex = int(xbmc.getInfoLabel("Container().CurrentItem")) - 1
osdItemsSize = int(xbmc.getInfoLabel("Container().NumItems"))

This does not match with the Container().ListItemAbsolute(INDEX).Label return values...

Is there any way to get a correct current index or item count in such lists?
Reply
#10
perhaps you can check this infobool:
Quote:Container.HasParent
Return true when the container contains a parent ('..') item.

and adjust your math based on that?
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

Logout Mark Read Team Forum Stats Members Help
ListItemAbsolute(0).Label broken?0