2011-08-15, 01:34
It was often mentioned - now it's about time to get it done.
This is now just discussion - it's not done yet
Skin variables are meant to get rid of multiples controls differing only by value of <texture> / <label> depending on <visible> condition.
Good example of its use are media flags (I'll use video type based on filename - bluray / hddvd / dvd / tv / vhs):
Currently this is done:
With skin variables it could be:
-- note difference with "dvd" checking: in variables condition I don't check against "hddvd" because if path would contain "hddvd" previous condition would be met and variable would already have value hddvd (and further checking would be aborted)
and then single image control with
Of course variables could contain $INFO[] or any ether element normal label / texture could have.
Skin variables could be contained in variables.xml
Do You have ideas how to make it better? Let's start discussion.
This is now just discussion - it's not done yet
Skin variables are meant to get rid of multiples controls differing only by value of <texture> / <label> depending on <visible> condition.
Good example of its use are media flags (I'll use video type based on filename - bluray / hddvd / dvd / tv / vhs):
Currently this is done:
Code:
<include name="VideoTypeHackFlaggingConditions">
<control type="image">
<description>Bluray Image</description>
<width>80</width>
<height>35</height>
<aspectratio align="left">keep</aspectratio>
<texture>flagging/video/bluray.png</texture>
<visible>[substring(ListItem.FilenameAndPath,bluray) | substring(ListItem.FilenameAndPath,bdrip)] + !Skin.HasSetting(HideFilenameFlagging)</visible>
</control>
<control type="image">
<description>HDDVD Image</description>
<width>80</width>
<height>35</height>
<aspectratio align="left">keep</aspectratio>
<texture>flagging/video/hddvd.png</texture>
<visible>substring(ListItem.FilenameAndPath,hddvd) + !Skin.HasSetting(HideFilenameFlagging)</visible>
</control>
<control type="image">
<description>DVD Image</description>
<width>80</width>
<height>35</height>
<aspectratio align="left">keep</aspectratio>
<texture>flagging/video/dvd.png</texture>
<visible>[substring(ListItem.FilenameAndPath,dvd) + ![substring(ListItem.FilenameAndPath,hddvd) | substring(ListItem.FilenameAndPath,bluray) | substring(ListItem.FilenameAndPath,bdrip)]] + !Skin.HasSetting(HideFilenameFlagging)</visible>
</control>
<control type="image">
<description>TV Types Image</description>
<width>80</width>
<height>35</height>
<aspectratio align="left">keep</aspectratio>
<texture>flagging/video/TV.png</texture>
<visible>[substring(ListItem.FilenameAndPath,pdtv) | substring(ListItem.FilenameAndPath,hdtv) | substring(ListItem.FilenameAndPath,dsr)] + !Skin.HasSetting(HideFilenameFlagging)</visible>
</control>
<control type="image">
<description>VHS Image</description>
<width>80</width>
<height>35</height>
<aspectratio align="left">keep</aspectratio>
<texture>flagging/video/vhs.png</texture>
<visible>substring(ListItem.FilenameAndPath,vhs) + !Skin.HasSetting(HideFilenameFlagging)</visible>
</control>
</include>
With skin variables it could be:
Code:
<variable name="filename_video_type">
<value condition="substring(ListItem.FilenameAndPath,bluray) | substring(ListItem.FilenameAndPath,bdrip)">bluray</value>
<value condition="substring(ListItem.FilenameAndPath,hddvd)">hddvd</value>
<value condition="substring(ListItem.FilenameAndPath,dvd)">dvd</value>
<value condition="substring(ListItem.FilenameAndPath,pdtv) | substring(ListItem.FilenameAndPath,hdtv) | substring(ListItem.FilenameAndPath,dsr)">TV</value>
<value condition="substring(ListItem.FilenameAndPath,vhs)">vhs</value>
</variable>
-- note difference with "dvd" checking: in variables condition I don't check against "hddvd" because if path would contain "hddvd" previous condition would be met and variable would already have value hddvd (and further checking would be aborted)
and then single image control with
Code:
<control type="image">
<description>Video type image</description>
<width>80</width>
<height>35</height>
<aspectratio align="left">keep</aspectratio>
<texture>$VAR[filename_video_type,flagging/video/,.png]</texture>
<!-- alternatively You could omit $VAR and use <texture>filename_video_type</texture> (along with slightly changed variable values) -->
<visible>!Skin.HasSetting(HideFilenameFlagging)</visible>
</control>
Of course variables could contain $INFO[] or any ether element normal label / texture could have.
Skin variables could be contained in variables.xml
Code:
<variables>
<variable name="x">
<value="foo">bar</value>
<value>default</value> <!-- if default not set then default value would be empty "" -->
</variable>
</variables>
Do You have ideas how to make it better? Let's start discussion.