Label Parsing: Difference between revisions
Jump to navigation
Jump to search
>Dankula No edit summary |
>DonJ No edit summary |
||
Line 21: | Line 21: | ||
If a song is playing that has title and artist information, it will return: | If a song is playing that has title and artist information, it will return: | ||
A good example of a song title: <Title>, and a song artist: <Artist> | A good example of a song title: <Title>, and a song artist: <Artist> | ||
[[category:Skin Development]] |
Revision as of 19:38, 2 February 2007
In label controls and fadelabel controls, as well as in the LCD label definition files you can specify more than one piece of information to be displayed in a single line of text (or across multiple lines of text) by using the $INFO and $LOCALIZE keywords in a <label> tag.
Example
<xml>
<label>A good example of a $INFO[MusicPlayer.Title,song title: , $COMMA and a]$INFO[MusicPlayer.Artist, song artist:]</label>
</xml>
How the parsing works
- XBMC runs through and replaces any $LOCALIZE[number] blocks with the real string from strings.xml.
- XBMC then runs through and translates the $INFO[infolabel,prefix,postfix] blocks from left to right.
- If the Info manager returns an empty string from the infolabel, then nothing is rendered for that block.
- If the Info manager returns a non-empty string from the infolabel, then XBMC prints the prefix string, then the returned infolabel information, then the postfix string. Note that any $COMMA fields are replaced by real commas, and $$ is replaced by $.
- Any pieces of information outside of the $INFO blocks are rendered unchanged.
So, in the above example, if nothing is playing then the label will print:
A good example of a
If a song is playing but it has no Title (ie MusicPlayer.Title? returns an empty string) but does have an artist, it will return:
A good example of a song artist: <Artist>
If a song is playing that has title and artist information, it will return:
A good example of a song title: <Title>, and a song artist: <Artist>