Kodi Community Forum
[Solved] Conditional Background - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Skins Support (https://forum.kodi.tv/forumdisplay.php?fid=67)
+--- Thread: [Solved] Conditional Background (/showthread.php?tid=163241)



[Solved] Conditional Background - WelshPaul - 2013-04-24

Dear All,

Can I pick your genius brains once again. I've been playing with conditional visibility, but can't get the following to work. I'm trying to get the background to correspond to the type of music playing, but this patently ain't right as it will always default to the second image. Is it a complete no-no to try and use labels in this way, or have I just got the conditions wrong?

Thanks

Code:
            <control type="image">
                <description>Background image</description>
                <posx>0</posx>
                <posy>0</posy>
                <width>1280</width>
                <height>720</height>
                <texture>Violin and Music 2.jpg</texture>
                <visible>MusicPlayer.Genre(Classical) | MusicPlayer.Genre(Operatic)</visible>
                </control>
            <control type="image">
                <description>Background image</description>
                <posx>0</posx>
                <posy>0</posy>
                <width>1280</width>
                <height>720</height>
                <texture>Electric Guitar.jpg</texture>
                <visible>!MusicPlayer.Genre(Classical) + !MusicPlayer.Genre(Operatic)</visible>
                </control>



RE: Conditional Background - MassIV - 2013-04-24

I didn't test but for the second try:
Code:
![MusicPlayer.Genre(Classical) | MusicPlayer.Genre(Operatic)]



RE: Conditional Background - WelshPaul - 2013-04-24

Can't really tell as it defaults to that anyway, presumably as the conditions are returning No regardless of whether its able to read it or not. I've tried $INFOs before them and that doesn't work. I'm also not sure the OR operator is right as I don't seem to have a keyboard key for "|" so I'm copying it from the wiki.


RE: Conditional Background - User 34959 - 2013-04-24

Does stringcompare work? Stringcompare($INFO[MusicPlayer.Genre],Classical) | Stringcompare($INFO[MusicPlayer.Genre],Operatic)


RE: Conditional Background - WelshPaul - 2013-04-24

Sadly not Toiva. Thanks for the suggestion, never used that before but just did a bit of reading up and also tried SubString but neither work.


RE: Conditional Background - MassIV - 2013-04-24

This works.
Code:
<visible>Substring(MusicPlayer.Genre,pop) | Substring(MusicPlayer.Genre,rap)</visible>
<visible>![Substring(MusicPlayer.Genre,pop) | Substring(MusicPlayer.Genre,rap)]</visible>

I think the others methods are not working because you are getting more then one genre back from:
Code:
<label>$INFO[MusicPlayer.Genre]</label>
So make a test label to see what you get as text output while playing a song. Then use that for the substring.


RE: Conditional Background - User 34959 - 2013-04-24

I would start by creating a simple text label which returns the genre of the playing media and making sure that it's actually returning Olassical or Operatic.


RE: Conditional Background - WelshPaul - 2013-04-24

You're right MassIV, that does work. I obviously had to switch from Beethoven to ABBA to test (pop rather than rap of course). I'll go away to puzzle over why this works, while you can bask in the glory of your supreme knowledge. Thanks both so much for your input.