Kodi Community Forum

Full Version: skinning help - code to list total items in a specific playlist
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm relatively new to any kind of skinning in xbmc. So sorry if this will seem like an easy question to any experts. I have searched online and couldn't find a solution to my problem. I basically have a submenu on my HOME screen in xbmc where I have links to various playlists that I have created for my movies based on various rules I have created. (I'm using a modified Aeon skin)

What I would like to to is create some kind of infolabel or text next to each link which sums the total number of items within that specific playlist.

E.g If I made a playlist of all movies that are tagged with "HDTV". I would like to have an text on the home screen next to that playlist link that summarizes the total number of items in that playlist : HDTV (35). That is if I had 35 HDTV movies. And this number changes automatically as movies are added and removed from this playlist.

This is what I currently have for the link. It is missing the code I would need to put the total number of items next to it.

Code:
<control type="button" id="39">
                    <visible>!Skin.HasSetting(enabletrailers)</visible>
                    <include>Submenu_MovieButton</include>
                    <include>MovieShortcutBools</include>
                    <label>HDTV</label>
                    <onclick>XBMC.ActivateWindow(MyVideoLibrary,special://profile/playlists/video/HDTV.xsp,return)</onclick>
                </control>


Thanks for any help in advance.
Not possible. The only way to count the number of items is using Container(id).NumItems but that's only for "opened" lists.
that is too bad..thanks for the info!
I Think a FakeContainer with the same content will do this?

<content target="Video>special://profile/playlists/video/HDTV.xsp<content>
And a Container(ID of the fakelist).NumItems
(2014-07-10, 13:18)Marc0810 Wrote: [ -> ]I Think a FakeContainer with the same content will do this?

<content target="Video>special://profile/playlists/video/HDTV.xsp<content>
And a Container(ID of the fakelist).NumItems

Yes, that would work, but then you will have to actually place that container in Home.xml. Depending on how many playlists we're talking about here, that could cause a performance hit.
Hey Jeroen,

Thanks for the note. I Set 108 Strings in the Startup.xml with Fake ListsSmile.
It Works very well, sometimes some Strings are Empty on a complete start, but most it works.

I thought there might be a way over variables for this problem...

PS. Sorry für my bad englisch..
Could you guys help give me a step by step of the code that you are talking about?

So In Home.xml or startup.xml what exact code would I put in for each of my playlists? I have 9 playlists.
And then in Home.xml how would I modify the label code that I pasted earlier in my original post?

Thanks so much guys....I need the step by step because I'm very new to understanding skinning Sad
Hey,

Are your Buttons in a Content like <content> <item="1">...?
ContainerNumItems I think doesent work in another Container Layout.
If You have separat buttons you can use:

Create a Fake Container like this in Home xml
Code:
            <control type="fixedlist" id="5111">
                <top>1</top>
                <height>1</height>
                <orientation>horizontal</orientation>
                <viewtype>list</viewtype>
                <scrolltime tween="sine" easing="out">320</scrolltime>
                <itemlayout width="1" height="1">
                <control type="label">
                    <label>$INFO[ListItem.Label]</label>
                </control>
                </itemlayout>
                <focusedlayout width="1" height="1">
                <control type="label">
                    <label>$INFO[ListItem.Label]</label>
                </control>
                </focusedlayout>
                <content target="video">special://profile/playlists/video/HDTV.xsp</content>
            </control>

Then you have Container(5111).NumItems for the Playlist HD in the same window.
Speed ​​must be tested. Jeroen has thus certainly right that there can be problems.

You can create this for each Playlist you want, or create a variable like Control.HasFocus with the nine playlists for displaying the number of items on ButtonFocus
Code:
    <variable name="xxx">
        <value condition="Control.HasFocus(39)">videodb://tvshows/titles/special://profile/playlists/video/HDTV.xsp</value>
        <value condition="Control.HasFocus(40)">videodb://tvshows/titles/xxx.xsp</value>
    </variable>

regards
I'm at work right now. I'll take a look at implementing and testing speed etc...when I get home and on the weekend. I'll let you guys know how it goes. Thanks so much for all your help so far!
Sorry I never got a chance to look at this until now. So I orignally miswrote. My buttons are in Includes_Submenu.xml

Here is an example of one of my buttons in the Includes_Submenu xml:

Code:
<control type="grouplist" id="940">
                <posx>-7</posx>
            <posy>20</posy>

                <width>1300</width>
                <height>70</height>
                <itemgap>-50</itemgap>
                <onup>300</onup>
                <ondown>352</ondown>
                
                <orientation>horizontal</orientation>
                <control type="button" id="38">
                    <include>Submenu_MovieButton</include>
                    <include>MovieShortcutBools</include>
                    <label>HDTV</label>
                    <onclick>XBMC.ActivateWindow(MyVideoLibrary,special://profile/playlists/video/HDTV.xsp,return)</onclick>
                </control>
.
.
.
.(All other button codes here...)
.
.
</control>


So where do I put the original code you provided? Do I still put it in Home.xml? I tried putting it in Includes_Submenu.xml but wasn't sure where exactly to place it.
Also can you tell me how I would modify the <label> code for the button? Would it be something like below?

Code:
<label>HDTV[CR]$INFO[Container(5111).NumItems]</label>

All I get in the end is a "0" like there are no items in the given playlist.

Any help is appreciated. Thanks again for all your help.