Parse control info tag
#46
cool... i'll check it out later.
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.
Reply
#47
Quote: put up an updated guicontrol.cpp on sourceforge, which implements discussed behaviour (hidding text inbetween items if one of them is not returning anything)..

i downloaded the patch after you mentioned this.

i put the following in the home.xml.

<control>
<description>time label</description>
<type>label</type>
<id>1</id>
<posx>525</posx>
<posy>415</posy>
<label>$localize(142) $info(musicplayer.time)/$info(musicplayer.duration)</label>
<align>right</align>
<font>font10</font>
</control>


with no audio playing time:/ shows up. maybe your file didn't update yetHuh i noticed the date was may 14.

it works fine when music is playing.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#48
guess it's my time to lecture you :o

<visible>player.hasaudio</visible>
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
#49
thank you :bowdown:
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#50
i can not get any $localize(12345) strings to work with the updated guicontrol.cpp.

did the format change?

also, might i suggest a new format.

this is extreme, but say you wanted a line like this.

<label>playing track $info(musicplayer.track) on $info(musicplayer.album) cd</label>

how does your code know what text goes with what $info(). could another seperator be added?

<label>{playing track $info(musicplayer.track) on }{$info(musicplayer.album) cd}</label>
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#51
(nuka1195 @ may 19 2005,07:38 Wrote:i can not get any $localize(12345) strings to work with the updated guicontrol.cpp.

did the format change?

also, might i suggest a new format.

this is extreme, but say you wanted a line like this.

<label>playing track $info(musicplayer.track) on $info(musicplayer.album) cd</label>

how does your code know what text goes with what $info(). could another seperator be added?

<label>{playing track $info(musicplayer.track) on }{$info(musicplayer.album) cd}</label>
i'll see what happened with the localize strings.

d.
Image
Reply
#52
ok i removed the guicontrol.cpp patch since i am not content with the conditional functionality it supplies (not to mention it contained a bug Smile ).

i'll be thinking about how to do it properly in the meantime.. probably will be introducing something like $if(condition,value) to support conditions.

i'll let u guys know when i have something else.
Image
Reply
#53
ok, the idea i'm implementing now is using $if(condition,value), value can be a literal and in case of a number it will be localized.
the condition will be an additive condition, the first info item will set the state of the bool, any additional info items do or an and or an or on the current state, not is also implemented. ok, i know it sounds vague, but i know what it does Smile lol
it basically means that something like:
a or b or c and d or e
is treated as:
((((a or b) or c) and d) or e)


so you could have something like:
now playing $info(musicplayer.title) $if(musicplayer.album,', from the album ') $info(musicplayer.album). [$info(musicplayer.year)$if(musicplayer.year and musicplayer.genre,', ')$info(musicplayer.genre)$if(musicplayer.year or musicplayer.genre and musicplayer.artist,', ')$info(musicplayer.artist), $info(musicplayer.bitrate)$if(not musicplayer.bitrate,'no bitrate available)]

my recommendation however is to make simple conditions, because it will become rather unreadable for those who are not used to boolean logic Smile

will test this when i get home.. unless someone has any better ideas Smile
Image
Reply
#54
i already committed it.  what bug?  it seemed to work fine for me with simple things like:

"$info(musicplayer.artist) - $info(musicplayer.album)" where i intentionally had the artist missing from the tag.

i donno about these conditionals.  its getting way too complicated now.  i dont think it needs to be any "better" than how the track formatter works.



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.
Reply
#55
(kraqh3d @ may 19 2005,13:35 Wrote:i already committed it.  what bug?  it seemed to work fine for me with simple things like:

"$info(musicplayer.artist) - $info(musicplayer.album)" where i intentionally had the artist missing from the tage.

i donno about these conditionals.  its getting way to complicated now.

yeah info worked, localize didn't.
i agree these conditionals look a bit more complicated, but are also a lot more flexible.

your example would become:
"$info(musicplayer.artist)$if(musicplayer.artist and musicplayer.album,' - ')$info(musicplayer.album)"

not too complicated yet. as i said, i suggest keeping it simple. but at least u can make it as complex as u like now.
Image
Reply
#56
what do you mean localize didnt? something like this:

"$info(musicplayer.artist)$localize(12345)$info(musicplayer.album)" would still show the localized string?
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.
Reply
#57
u were replying while i was editting... this is key line:

i dont think it needs to be any "better" than how the track formatter works.

*edit*

ah, forget it, i dont care as long as the simple way continues to work where missing tags remove adjoining text blocks.



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.
Reply
#58
(kraqh3d @ may 19 2005,13:44 Wrote:what do you mean localize didnt?  something like this:

"$info(musicplayer.artist)$localize(12345)$info(musicplayer.album)" would still show the localized string?
no $localize didn't /doesn't work at all, it will never write the localized string... somehow i never tested thatSmile

i disagree about not getting better.

a string like "now playing (artist) with track (track)" would also remove the "now playing" part if the artist is not available. the solution only worked well for simple, non textual delimiters. my new suggestion works for (almost) anything.
Image
Reply
#59
lol...
well.. i can't really have both solutions... cause the new idea always renders literal texts, while they old idea renders literal texts conditionally... Smile
Image
Reply
#60
i'll check out why the localized strings arent added to the output string. an append is probably missing someplace Smile

i dont understand why cant you have both. the $if is a new control type. anything without an $if should be subjected to the old rules.

anyway, i think this is overkill and unwarranted.
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.
Reply

Logout Mark Read Team Forum Stats Members Help
Parse control info tag0