Solved Container - absolute number of items or has parent item
#1
When using animations based on the number of items in a list everything is fine until you have the parent folder item as well. The you have to use loads of strings compares to check if one of the items is in fact the parent folder item.

eg

Code:
<animation condition="StringCompare(Container(21).NumItems,0) | StringCompare(Container(21).NumItems,1) | [StringCompare(Container(21).NumItems,2) + [!StringCompare(Container(21).ListItem.Label,..) + !StringCompare(Container(21).ListItem(1).Label,..) + !StringCompare(Container(21).ListItem(2).Label,..)]]" effect="slide" end="0,-336">Conditional</animation>
<animation condition="[StringCompare(Container(21).NumItems,2) + [StringCompare(Container(21).ListItem.Label,..) | StringCompare(Container(21).ListItem(1).Label,..) | StringCompare(Container(21).ListItem(2).Label,..)]] | StringCompare(Container(21).NumItems,3) | [StringCompare(Container(21).NumItems,4) + [!StringCompare(Container(21).ListItem.Label,..) + !StringCompare(Container(21).ListItem(1).Label,..) + !StringCompare(Container(21).ListItem(2).Label,..) + !StringCompare(Container(21).ListItem(3).Label,..) + !StringCompare(Container(21).ListItem(4).Label,..)]]" effect="slide" end="0,-252">Conditional</animation>
<animation condition="[StringCompare(Container(21).NumItems,4) + [StringCompare(Container(21).ListItem.Label,..) | StringCompare(Container(21).ListItem(1).Label,..) | StringCompare(Container(21).ListItem(2).Label,..) | StringCompare(Container(21).ListItem(3).Label,..) | StringCompare(Container(21).ListItem(4).Label,..)]] | [StringCompare(Container(21).NumItems,5) + [StringCompare(Container(21).ListItem.Label,..) | StringCompare(Container(21).ListItem(1).Label,..) | StringCompare(Container(21).ListItem(2).Label,..) | StringCompare(Container(21).ListItem(3).Label,..) | StringCompare(Container(21).ListItem(4).Label,..) | StringCompare(Container(21).ListItem(5).Label,..)]] | StringCompare(Container(21).NumItems,5) | StringCompare(Container(21).NumItems,6)" effect="slide" end="0,-168">Conditional</animation>
<animation condition="[StringCompare(Container(21).NumItems,6) + [StringCompare(Container(21).ListItem.Label,..) | StringCompare(Container(21).ListItem(1).Label,..) | StringCompare(Container(21).ListItem(2).Label,..) | StringCompare(Container(21).ListItem(3).Label,..) | StringCompare(Container(21).ListItem(4).Label,..) | StringCompare(Container(21).ListItem(5).Label,..) | StringCompare(Container(21).ListItem(6).Label,..)]] | StringCompare(Container(21).NumItems,7) | [StringCompare(Container(21).NumItems,7) + [StringCompare(Container(21).ListItem.Label,..) | StringCompare(Container(21).ListItem(1).Label,..) | StringCompare(Container(21).ListItem(2).Label,..) | StringCompare(Container(21).ListItem(3).Label,..) | StringCompare(Container(21).ListItem(4).Label,..) | StringCompare(Container(21).ListItem(5).Label,..) | StringCompare(Container(21).ListItem(6).Label,..) | StringCompare(Container(21).ListItem(7).Label,..)]] | StringCompare(Container(21).NumItems,8)" effect="slide" end="0,-84">Conditional</animation>

A solution to this would be either of these -

Code:
Container(id).HasParent           Returns true if the container contains the parent folder item (or current container if id is omitted).
Container(id).AbsoluteNumItems    Number of items in the container with given id including the parent folder item. If no id is specified it grabs the current container.

Thanks.
Reply
#2
haven't tested it myself, but since some skins are using it i assume it works:
Code:
system.getbool(filelists.showparentdiritems)

would that be suitable for your usecase as well?
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
Doh, how did I forget that?

One of those days.


EDIT: I wasn't having a brain fart moment after all.

The conditions still fail when you have parent folder items enabled and you're in the root where there is no parent folder item.

So the request still stands.
Reply
#4
Container(id).NumItems in combination with System.GetBool(filelists.showparentdiritems) is not working?
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#5
Not when you have 'Show parent folder' enabled and you're in a root folder because it wont have a parent folder.

eg Using Container.NumItems + System.GetBool(filelists.showparentdiritems) these 2 lists would get the same result -

Image

Thanks.
Reply
#6
Perhaps Stringcompare(Container(..).ListItemPosition(0).Label,..) ?
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#7
Nice one Phil, will try it out. Thanks.
Reply
#8
(2015-07-17, 20:33)phil65 Wrote: Perhaps Stringcompare(Container(..).ListItemPosition(0).Label,..) ?

Doesn't work as this label changes depending on the number of items in the list and the focus position.
Reply
#9
True, just tested it, too. (I thaught before that it would return the "absolute" first item of a list)
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#10
Shame because that would have been perfect.
Reply
#11
For the record. https://github.com/xbmc/xbmc/pull/7714 added Container.HasParent. See http://forum.kodi.tv/showthread.php?tid=...pid2073590 for more information.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply

Logout Mark Read Team Forum Stats Members Help
Container - absolute number of items or has parent item0