Kodi Community Forum
Solved How to skip empty items in a list - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12)
+--- Thread: Solved How to skip empty items in a list (/showthread.php?tid=345520)

Pages: 1 2


How to skip empty items in a list - chrissix666 - 2019-07-19

This code compares the cast with a resource addon and shows them in a multiimage.
Code working but...
How can i achieve that if a cast actor who has no image would be skipped?
Now i have gaps in sideshow when there is no image in resource addon.
I want only show when images there.

Please, i'm really not a xml skilled member and my native language is not english. If you have any advice maybe so thats also understandable for noobs  Confused
I just want to give my ARTWORK PROJECT more usability for general audience in skins -> kodi.tv thread
___
This is my code:

   
Code:
        <control type="group">
            <control type="list" id="324">
                <left>-3000</left>
                <top>-3000</top>
                <height>1</height>
                <width>1</width>
                <autoscroll>true</autoscroll>
                <scrolltime>5000</scrolltime>
                <itemlayout/>
                <focusedlayout/>
                <content>
                    <item>
                        <label>$INFO[Window(home).Property(cast.0)]</label>
                        <onclick>noop</onclick>
                        <visible>!String.IsEmpty(Window(home).Property(cast.0))</visible>
                    </item>
                    <item>
                        <label>$INFO[Window(home).Property(cast.1)]</label>
                        <onclick>noop</onclick>
                        <visible>!String.IsEmpty(Window(home).Property(cast.1))</visible>
                    </item>
                    <item>
                        <label>$INFO[Window(home).Property(cast.2)]</label>
                        <onclick>noop</onclick>
                        <visible>!String.IsEmpty(Window(home).Property(cast.2))</visible>
                    </item>
                    <item>
                        <label>$INFO[Window(home).Property(cast.3)]</label>
                        <onclick>noop</onclick>
                        <visible>!String.IsEmpty(Window(home).Property(cast.3))</visible>
                    </item>
                    <item>
                        <label>$INFO[Window(home).Property(cast.4)]</label>
                        <onclick>noop</onclick>
                        <visible>!String.IsEmpty(Window(home).Property(cast.4))</visible>
                    </item>
                    <item>
                        <label>$INFO[Window(home).Property(cast.5)]</label>
                        <onclick>noop</onclick>
                        <visible>!String.IsEmpty(Window(home).Property(cast.5))</visible>
                    </item>    
                    <item>
                        <label>$INFO[Window(home).Property(cast.6)]</label>
                        <onclick>noop</onclick>
                        <visible>!String.IsEmpty(Window(home).Property(cast.6))</visible>
                    </item>
                    <item>
                        <label>$INFO[Window(home).Property(cast.7)]</label>
                        <onclick>noop</onclick>
                        <visible>!String.IsEmpty(Window(home).Property(cast.7))</visible>
                    </item>
                    <item>
                        <label>$INFO[Window(home).Property(cast.8)]</label>
                        <onclick>noop</onclick>
                        <visible>!String.IsEmpty(Window(home).Property(cast.8))</visible>
                    </item>
                    <item>
                        <label>$INFO[Window(home).Property(cast.9)]</label>
                        <onclick>noop</onclick>
                        <visible>!String.IsEmpty(Window(home).Property(cast.9))</visible>
                    </item>
                    <item>
                        <label>$INFO[Window(home).Property(cast.10)]</label>
                        <onclick>noop</onclick>
                        <visible>!String.IsEmpty(Window(home).Property(cast.10))</visible>
                    </item>                    
                </content>
            </control>
            <!-- Fake multiimage control -->            
            <control type="image">
                <left>1083</left>
                <top>123</top>
                <width>397</width>
                <height>573</height>
                <aspectratio align="center" aligny="bottom">keep</aspectratio>
                <texture background="true">$INFO[Container(324).ListItem.Label,resource://resource.images.actorart/,.png]</texture>
                <fadetime>1000</fadetime>    
            </control>
            <control type="textbox">
                <font>Font_plot4</font>
                <align>center</align>
                <left>1080</left>
                <top>657</top>
                <width>397</width>
                <height>40</height>
                <label>$INFO[Container(324).ListItem.Label]</label>                                
            </control>
            </control>    



RE: How to skip empty items in a list - sualfred - 2019-07-19

You cannot, because you are referring to a local file.

Use a fallback image behind the image control with exactly the same dimensions and position.


RE: How to skip empty items in a list - chrissix666 - 2019-07-19

(2019-07-19, 18:17)sualfred Wrote: You cannot
Are you sure? @manfeed got it managed with a (for me incomprehensible) code construct -> code


RE: How to skip empty items in a list - sualfred - 2019-07-19

Yes, you cannot check for the existance of a local file. Or at least only partly -> https://github.com/sualfred/script.embuary.helper/wiki/Script:-Actions-and-helpers#check-if-file-exists


RE: How to skip empty items in a list - chrissix666 - 2019-07-19

An idea why @manfeed  did it anyway with his code?
Here all empty is skipped:

___
Could i achieve this also with your "exist file check" helper codes?


RE: How to skip empty items in a list - sualfred - 2019-07-19

Without looking at the code I cannot tell whick kind of skin hack he is using. Possible is everything. It's just a question complexity question. Ask him directly.


RE: How to skip empty items in a list - mardukL - 2019-07-19

You can try to work with a hidden button, which has the visibility condition if your image (control.getlabel) is empty and use control.move(id,1) as on focus action.

xml:
e.g.
<control type="image" id="7999">
                        <visible>!String.IsEmpty(Control.GetLabel(7999))</visible>
                        <width>130</width>
                        <height>90</height>
                        <aspectratio aligny="center" align="left">keep</aspectratio>
                        <fadetime>200</fadetime>
                        <texture background="true">,resource://resource.images.*??**/</texture>
                     </control>


e.g., you can also put the hidden button out of 'eye visible' control
<control type="button" id="7998">
                     <visible>String.IsEmpty(Control.GetLabel(7999))</visible>
                     <width>1</width>
                    <height>1<height>
                    <align/>
                    <aligny/>
                    <font/>
                    <label/>
                    <textcolor/>
                    <focusedcolor/>
                    <disabledcolor/>
                    <pulseonselect/>
                    <texturefocus/>
                    <texturenofocus/>
                    <textoffsetx/>
                    <onfocus>Control.Move(yourid,1)</onfocus>
              </control>


@sualfred a bit off topic but
Quote:You cannot, because you are referring to a local file.

I use a fallback Button, if Resource addon image is empty, here for studio logo.
Using

xml:
<control type="image" id="7999">
                        <visible>!String.IsEmpty(Control.GetLabel(7999)) + !String.IsEmpty(ListItem.Studio)</visible>
                        <width>130</width>
                        <height>90</height>
                        <aspectratio aligny="center" align="left">keep</aspectratio>
                        <fadetime>200</fadetime>
                        <texture background="true">$VAR[image_StudioLogo]</texture>
                        <colordiffuse condition="String.IsEqual(Skin.String(studiologos.path),resource://resource.images.studios.white/)">$VAR[AdvancedRatings_TextColor]</colordiffuse>
                    </control>
                    <control type="button" id="7998">
                        <visible>String.IsEmpty(Control.GetLabel(7999)) + !String.IsEmpty(ListItem.Studio)</visible>
                        <width max="200">auto</width>
                        <height>90</height>
                        <font>Reg20</font>
                        <label>$INFO[ListItem.Studio]</label>
                        <aligny>center</aligny>
                        <align>center</align>
                        <wrapmultiline>true</wrapmultiline>
                        <textcolor>$INFO[Skin.String(ViewDetailsTextColor)]</textcolor>
                        <disabledcolor>$INFO[Skin.String(ViewDetailsTextColor)]</disabledcolor>
                        <texturenofocus colordiffuse="$INFO[Skin.String(ViewDetailsTextColor)]">netflix/frame/slimframe_softedge.png</texturenofocus>
                        <textoffsetx>10</textoffsetx>
                        <textoffsety>7</textoffsety>
                        <enable>false</enable>
                    </control>

proof:  loading time is faster, just got a bad capture software Wink
https://streamable.com/sofld


RE: How to skip empty items in a list - chrissix666 - 2019-07-19

(2019-07-19, 18:45)sualfred Wrote: Without looking at the code I cannot tell whick kind of skin hack he is using. Possible is everything. It's just a question complexity question. Ask him directly.
It's the equal code linked in post #3
Unfortunately, this code construct does not work for Krypton port.

EDIT: @latts9923 is very skilled, tried also to port, unfortunately without success.


RE: How to skip empty items in a list - sualfred - 2019-07-19

He is using the common Control.GetLabel approach. If hidden image doesn't get loaded, because the file does not exist, it will return no value.


RE: How to skip empty items in a list - chrissix666 - 2019-07-19

(2019-07-19, 18:58)sualfred Wrote: He is using the common Control.GetLabel approach
So sure it is possible? No idea how to start.


RE: How to skip empty items in a list - sualfred - 2019-07-19

Du stehst aufm Schlauch.

Try this:
Download my helper from github.

Use this content path in your fake multiimage control where you are gonna display the images
xml:
plugin://script.embuary.helper/?info=getresourceimages&addon=resource.images.actorart&id=200&reload=$INFO[Container(200).NumItems]

addon = the resource addon you want to use
id = the id of the container which the content is based on (for example a regular cast container)
reload = required to reload the container if the cast container refreshes

What does this thing do:
1. First it's going to fetch all available resource images of the targeted resource addon.
2. It crawls all available labels from the source container with id 200 (example "Paul Walker", "Eva Mendes", "Axel Schweiss", "...").
3. If "Paul Walker" is available as "Paul Walker.png" it will add it as item to the container. If not it will be skipped.

The result should look like this
Image

Edit:
It's quick'n'dirty. So I'm just guessing it should work fine.


RE: How to skip empty items in a list - chrissix666 - 2019-07-19

(2019-07-19, 21:08)sualfred Wrote: Du stehst aufm Schlauch.
Als Maurer und Schalungsbauer habe ich eher meine Hobby-Leidenschaft eindeutig verfehlt! Ich gebe nicht auf...
___
New updated Krypton branch needs little bug fixing, error on install -> log in cloud
___
Great i will test it! Really hope i can handle the code.


RE: How to skip empty items in a list - sualfred - 2019-07-19

Wait with the code. I give you a much easier option.


RE: How to skip empty items in a list - sualfred - 2019-07-19

Now you owe me one. No need for any skin hack or hidden controls anymore. Everything is directly handled by a provided string.

To get resource images by cast or any other string that needs to be splitted by line:
Code:
plugin://script.embuary.helper/?info=getresourceimages&addon=resource.images.actorart&string='$ESCINFO[ListItem.Cast]'

To get resources images by studio, genre, director or any other string that is separated by " / " or " - " etc:
Code:
plugin://script.embuary.helper/?info=getresourceimages&addon=resource.images.actorart&separator='" / "'&string='$ESCINFO[ListItem.Cast]'



RE: How to skip empty items in a list - chrissix666 - 2019-07-19

(2019-07-19, 21:40)sualfred Wrote: Now you owe me one. No need for any skin hack or hidden controls anymore. Everything is directly handled by a provided string.
Now i am really curious!
still a install failure on latest github -> log