Label Parsing: Difference between revisions

From Official Kodi Wiki
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

  1. XBMC runs through and replaces any $LOCALIZE[number] blocks with the real string from strings.xml.
  2. XBMC then runs through and translates the $INFO[infolabel,prefix,postfix] blocks from left to right.
  3. If the Info manager returns an empty string from the infolabel, then nothing is rendered for that block.
  4. 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 $.
  5. 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>