Kodi Community Forum

Full Version: Container(id).CurrentItem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Not sure if it's actually worth posting at this current time but here goes anyway.

At the moment we can get the total number of items in a list but there's no way (that I know of at least) to get the actual current item number in that list in the same way we can with pages.

Page labels
Code:
Container(id).NumPages    Number of pages in the container with given id. If no id is specified it grabs the current container.
Container(id).CurrentPage    Current page in the container with given id. If no id is specified it grabs the current container.

Item labels
Code:
Container(id).CurrentPage    Current page in the container with given id. If no id is specified it grabs the current container.
Container(id).Position    Returns the current focused position of Container (id) as a numeric label.

Requested label
Code:
Container(id).CurrentItem    Current item in the container with given id. If no id is specified it grabs the current container.

Thanks.
I would love this.

I've recently ran into a problem with dynamic lists that I didn't have before with the static ones. I would use Container(ID).HasFocus(x) to trigger a visibility condition based on the focused item in a list. Unfortunately this doesn't seem to work with dynamic lists and for all my tries I can't get a suitable workaround to work.

I saw that you're using a script from Unfledged to grab the CurrentItem number in fTV. Any chance you can point me to a link to grab that script?

removed151214

https://github.com/unfledged/service.listindex

It sets the absolute list index to Window(10000).Property(listindex). Note, it's a shameless hack and would be something that would be so much better added into the skinning engine if there's anyone out there with the knowledge and interest to do so. Smile

(It also focuses episode lists on the next unwatched episode.)
I am not that much into the guilib but there's Container(id).SubItem that should (at least" from a brief look) return the currently focused item.
(2014-12-03, 09:59)mkortstiege Wrote: [ -> ]I am not that much into the guilib but there's Container(id).SubItem that should (at least" from a brief look) return the currently focused item.

Doesn't return anything for me. Confused

EDIT: Having looked myself it's actually a Boolean condition and not a list item label.

EDIT2: Upon further investigation Container(id).SubItem(0) seems to be the only true value no matter where you are in a list.

Code used to test this only ever shows 0.

Code:
$VAR[CurrentItem]

<variable name="CurrentItem">
    <value condition="Container(50).SubItem(0)">0</value>
    <value condition="Container(50).SubItem(1)">1</value>
    <value condition="Container(50).SubItem(2)">2</value>
    <value condition="Container(50).SubItem(3)">3</value>
    <value condition="Container(50).SubItem(4)">4</value>
    <value condition="Container(50).SubItem(5)">5</value>
    <value condition="Container(50).SubItem(6)">6</value>
    <value>EMPTY</value>
</variable>
@Hitcher, odd. Are you able to patch and build or do you need a test build? I can recall you're using win32, right?
No I can't so a test build would be appreciated and I'm using Windows 64bit.

PS See my second edit.
Ok, will trigger a test build. Re SubItem .. there must be a reason this is not documented in the wiki :p
Thanks.

There's a few others I spotted in the GUIInfoManager that aren't in the wiki. Huh
(2014-12-03, 11:21)Hitcher Wrote: [ -> ]Thanks.

There's a few others I spotted in the GUIInfoManager that aren't in the wiki. Huh

feel free to add whatevers missing to the wiki,
in case you need a hand, just let me know...
testbuild @ http://mirrors.xbmc.org/test-builds/win32/. Please let me know if it works for you and/or if something is missing.

EDIT: Use Container(id).CurrenItem. There are no changes in regards to the SubItem one.
(2014-12-03, 11:29)ronie Wrote: [ -> ]
(2014-12-03, 11:21)Hitcher Wrote: [ -> ]Thanks.

There's a few others I spotted in the GUIInfoManager that aren't in the wiki. Huh

feel free to add whatevers missing to the wiki,
in case you need a hand, just let me know...
Will do and I'll PM you if I can't work out what they are for.
(2014-12-03, 11:39)mkortstiege Wrote: [ -> ]testbuild @ http://mirrors.xbmc.org/test-builds/win32/. Please let me know if it works for you and/or if something is missing.

EDIT: Use Container(id).CurrenItem. There are no changes in regards to the SubItem one.
Works perfectly with one small exception - it's counting the first item as 0 when it should really be 1 and it also doesn't ignore the parent folder item (if enabled) like the number of items does.
Great. Will change and put up a PR.
Just to get it right before creating the pull request. The first actual item has position 0 in the container and parent is always -1. Correct? Just asking so we have it consistent.
First actual item with parent folder enabled is 1, and the parent is 0.
First actual item with parent folder disabled is 1.

As it is now it works fine with the parent folder enabled (parent = 0, 1st item = 1) so all we need is to add 1 when parent folder items are disabled - !system.getbool(filelists.showparentdiritems)

Thanks.
Pages: 1 2