Posts: 73
Joined: Aug 2016
Reputation:
0
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?
Posts: 15,263
Joined: Jan 2009
Reputation:
727
ronie
Team-Kodi Member
Posts: 15,263
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 ;-)
Posts: 73
Joined: Aug 2016
Reputation:
0
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...
Posts: 73
Joined: Aug 2016
Reputation:
0
I have no container ID. Can I just use your string as it is?
Posts: 15,263
Joined: Jan 2009
Reputation:
727
ronie
Team-Kodi Member
Posts: 15,263
nope, you'll need the id of the container, eg:
Container(9000).ListItemAbsolute(0).Label
Posts: 73
Joined: Aug 2016
Reputation:
0
Is it possible to request the current id?
Posts: 73
Joined: Aug 2016
Reputation:
0
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?