fallback for mix of image and strings
#1
Hi,

Is there a way for me to display an image but if said image doesn't exist, fallback
to a string?

-Pr.
[4 Kodi Clients + 4 Norco RPC-4224 Media Servers w/376 TB HDD Space]
Reply
#2
Something like this?

Code:
<texture fallback="Default_icon.png">$INFO
[ListItem.Label,,_icon.png]</texture>

Was added here I believe: http://xbmc.svn.sourceforge.net/viewvc/x...sion=21336
Reply
#3
note, you can only fallback to a 'static' image and not to an $INFO string:
http://forum.xbmc.org/showthread.php?tid...t=fallback
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
#4
XBMCG33K Wrote:Something like this?

Code:
<texture fallback="Default_icon.png">$INFO
[ListItem.Label,,_icon.png]</texture>

Was added here I believe: http://xbmc.svn.sourceforge.net/viewvc/x...sion=21336

Nope.

I want to display an image and if the image doesn't exist, i want to display text.

Is there a boolean condition called IfExist?

I was thinking to just display the text and display the picture on top of it and
use IfExist on the filename for the visibility of the text.

-Pr.
[4 Kodi Clients + 4 Norco RPC-4224 Media Servers w/376 TB HDD Space]
Reply
#5
Putting a label under the image seems the simplest technique. If the image isn't there, you'll see the label. If it is, you won't.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#6
jmarshall Wrote:Putting a label under the image seems the simplest technique. If the image isn't there, you'll see the label. If it is, you won't.

Ya but i am afraid that some text might be too long to be completely hidden
by the image. The text is not static since it is called by $INFO[VideoPlayer.TVShowTitle]

-Pr.
[4 Kodi Clients + 4 Norco RPC-4224 Media Servers w/376 TB HDD Space]
Reply
#7
Use the <width> of the label to ensure that?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#8
jmarshall Wrote:Use the <width> of the label to ensure that?

Yeah i will try that and see how it looks...

Anyway, the images i want to display (TV Banners) are fairly easy to get so
hopefully the text label will never be seen...

-Pr.
[4 Kodi Clients + 4 Norco RPC-4224 Media Servers w/376 TB HDD Space]
Reply
#9
Pr.Sinister Wrote:Nope.

I want to display an image and if the image doesn't exist, i want to display text.

Is there a boolean condition called IfExist?

I was thinking to just display the text and display the picture on top of it and
use IfExist on the filename for the visibility of the text.

-Pr.

you may want to check the code in PM3.HD
it uses a similar technique to display a text string when no episode thumb is available. (in fanart view)
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
#10
I tried the technique but this will only work if the image isn't using transparency. Any other ideas on how to handle this?
Reply
#11
if you can come up with some kind of visible condition for the image, this may work:
[HTML]<control type="label">
...
<visible>!Control.IsVisible(1234)</visible>
</control>
<control type="image" id="1234">
...
<visible>!IsEmpty(foo)</visible>
</control>[/HTML]
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
#12
Unfortunately I can't. I'm trying to display a studio logo if available and just display the studio name as a label if not. So Listitem.studio is always set (can't use IsEmpty) but <texture> can fail if the image isn't available. Any ideas? It would be helpful if visible was set to false if <texture> fails and no fallback is available or if the fallback fails as well.
Reply
#13
How about setting the fallback for the image to a texture that doesn't exist (or is transparent) but has a unique name?

Then you might be able to use Control.GetLabel() or whatever it is perhaps?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply

Logout Mark Read Team Forum Stats Members Help
fallback for mix of image and strings0