Test for empty (non-existent) file?
#1
Hello!

I'm trying to proof my code for clearart.png in DialogFullScreenInfo.xml. By skin setting, I'm showing the clearart instead of VideoPlayer.Cover (which is a thumb). What I'd like to add is a condition to show clearart on skin.hassetting and also to test if the file clearart.png exist. I looked at the wiki, but I haven't found the command to do so... here's my code from DialogFullScreenInfo.xml:

Code:
<control type="image">
                    <posx>994</posx>
                    <posy>35</posy>
                    <width>263</width>
                    <height>148</height>
                    <texture>$INFO[VideoPlayer.Cover]</texture>
                    <visible>!Skin.HasSetting(TVClearart)</visible>
                </control>
                <control type="image">
                    <posx>965</posx>
                    <posy>10</posy>
                    <width>284</width>
                    <height>160</height>                    
                    <texture>$INFO[Player.FolderPath]../clearart.png</texture>
                    <texture>$INFO[Player.FolderPath]/clearart.png</texture>
                    <visible>Skin.HasSetting(TVClearart)</visible>
                </control>


Thanks for yuor help!
Reply
#2
(2012-08-29, 15:56)Balinus Wrote: Hello!

I'm trying to proof my code for clearart.png in DialogFullScreenInfo.xml. By skin setting, I'm showing the clearart instead of VideoPlayer.Cover (which is a thumb). What I'd like to add is a condition to show clearart on skin.hassetting and also to test if the file clearart.png exist. I looked at the wiki, but I haven't found the command to do so... here's my code from DialogFullScreenInfo.xml:

Thanks for your help!
Balinus,

I use a blank file as a fallback on the <texture> tag and then check if the image label for the image is that blank file. This is from my DialogFullScreenInfo.xml file

Code:
<control type="image" id="990">
        <description>Use TV Clearart if available(episodes in season folders)</description>
        <posx>8</posx>
        <posy>-145</posy>
        <width>275</width>
        <height>145</height>
        <texture fallback="blank.png">$INFO[Player.FolderPath,,../clearart.png]</texture>
        <aspectratio>keep</aspectratio>
    </control>
    <control type="image" id="991">
        <description>Use TV Clearart if available(episodes in tv show folder)</description>
        <posx>8</posx>
        <posy>-145</posy>
        <width>275</width>
        <height>145</height>
        <texture fallback="blank.png">$INFO[Player.FolderPath,,clearart.png]</texture>
        <aspectratio>keep</aspectratio>
    </control>
    <control type="group">
        <visible>StringCompare(Control.GetLabel(990),blank.png)
                 + StringCompare(Control.GetLabel(991),blank.png)</visible>
        <control type="image" id="992">
            <description>Otherwise try TV logo if available(episodes in season folders)</description>
            <posx>8</posx>
            <posy>-75</posy>
            <width>276</width>
            <height>75</height>
            <texture fallback="blank.png">$INFO[Player.FolderPath,,logo.png]</texture>
            <aligny>bottom</aligny>
            <aspectratio align="left">keep</aspectratio>
        </control>
...

Wyrm (xTV-SAF)

If required a FULL debug log can now be submitted from the skin in settings->skin settings->support. Or follow instructions here if you can't access skin settings.

FAQ's located at :- http://kodi.wiki/view/Add-on:AppTV
Reply
#3
oh clever! So if I understand correctly, you have a file name blank.png in your media folder?and stringcompare will return true on your visible condition for the logo.png?

Thanks!
Reply
#4
No there is no real blank.png... that's just the label of the image control (because it uses the fallback) if clearart.png doesn't exist. You could also name the fallback "empty" or whatever.
Image
Reply
#5
ok, thanks for the clarification!
Reply
#6
Nice, works like a charm. Thanks guys! I've also added logo.png, as shown by wyrm. Here's the code for reference:

edit - Actually, if clearart.png and logo.png are available, both pngs are shown... :/
edit2- ok, sorry, just forgot to add visible conditions.... so that works!

Code:
<control type="image" id="990">
        <posx>965</posx>
        <posy>10</posy>
        <width>284</width>
        <height>160</height>                
        <texture fallback="blank.png">$INFO[Player.FolderPath]../clearart.png</texture>
</control>
<control type="image" id="991">
        <posx>965</posx>
        <posy>10</posy>
        <width>284</width>
        <height>160</height>
        <texture fallback="blank.png">$INFO[Player.FolderPath]/clearart.png</texture>
</control>
<control type="image" id="992">
        <posx>965</posx>
        <posy>-20</posy>
        <width>284</width>
        <height>160</height>                
        <texture fallback="blank.png">$INFO[Player.FolderPath]../logo.png</texture>
                <visible>StringCompare(Control.GetLabel(990),blank.png)
                 + StringCompare(Control.GetLabel(991),blank.png)</visible>
</control>
<control type="image" id="993">
        <posx>965</posx>
        <posy>-20</posy>
        <width>284</width>
        <height>160</height>
        <texture fallback="blank.png">$INFO[Player.FolderPath]/logo.png</texture>
                <visible>StringCompare(Control.GetLabel(990),blank.png)
                 + StringCompare(Control.GetLabel(991),blank.png)</visible>
</control>
<control type="image">                  
        <posx>994</posx>
        <posy>35</posy>
        <width>263</width>
        <height>148</height>
        <texture>$INFO[VideoPlayer.Cover]</texture>
        <visible>StringCompare(Control.GetLabel(990),blank.png)
                 + StringCompare(Control.GetLabel(991),blank.png)+     StringCompare(Control.GetLabel(992),blank.png)+    StringCompare(Control.GetLabel(993),blank.png) </visible>
<control>
Reply
#7
(2012-08-29, 17:00)`Black Wrote: No there is no real blank.png... that's just the label of the image control (because it uses the fallback) if clearart.png doesn't exist. You could also name the fallback "empty" or whatever.
Black,

Yes strictly speaking you don't require a blank.png file to be present, but I have as I was worried that if the file was not found it might use the default fallback instead. The blank file is tiny and is just that a blank png image, so the user will see nothing.

Wyrm (xTV-SAF)

If required a FULL debug log can now be submitted from the skin in settings->skin settings->support. Or follow instructions here if you can't access skin settings.

FAQ's located at :- http://kodi.wiki/view/Add-on:AppTV
Reply
#8
(2012-08-29, 17:41)Balinus Wrote: Nice, works like a charm. Thanks guys! I've also added logo.png, as shown by wyrm. Here's the code for reference:

edit - Actually, if clearart.png and logo.png are available, both pngs are shown... :/
edit2- ok, sorry, just forgot to add visible conditions.... so that works!
Balinus,

Yes, noticed the bug when I posted the code originally (thus the edit to the post right after I posted). You might want to take a look at my code to see what I do with the visible conditions, I know it is not really an issue, but I nest each section of clearart/logo/thumb images in group statements to cut back on the long <visible> statements (and having to repeat <visible> for each image block). I'm sure it makes scruff all difference to the speed, just makes it easier to read whats going on.

Wyrm (xTV-SAF)

If required a FULL debug log can now be submitted from the skin in settings->skin settings->support. Or follow instructions here if you can't access skin settings.

FAQ's located at :- http://kodi.wiki/view/Add-on:AppTV
Reply
#9
(2012-08-30, 04:00)wyrm Wrote:
(2012-08-29, 17:41)Balinus Wrote: Nice, works like a charm. Thanks guys! I've also added logo.png, as shown by wyrm. Here's the code for reference:

edit - Actually, if clearart.png and logo.png are available, both pngs are shown... :/
edit2- ok, sorry, just forgot to add visible conditions.... so that works!
Balinus,

Yes, noticed the bug when I posted the code originally (thus the edit to the post right after I posted). You might want to take a look at my code to see what I do with the visible conditions, I know it is not really an issue, but I nest each section of clearart/logo/thumb images in group statements to cut back on the long <visible> statements (and having to repeat <visible> for each image block). I'm sure it makes scruff all difference to the speed, just makes it easier to read whats going on.


Wyrm (xTV-SAF)

Thanks, will have a look at it! Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Test for empty (non-existent) file?0