Rockbox Technical Forums

Support and General Use => Theming and Appearance Customization => Topic started by: ELCore on November 14, 2011, 09:08:13 AM

Title: Help with nested conditional sublines
Post by: ELCore on November 14, 2011, 09:08:13 AM
Hello. I love rockbox! I use it on my Sansa Fuze. I have been modifying the WPS of the kyo-rocked theme.

I have one line with two sublines. First, it displays the playlist name; then it displays the next song in either of two ways: if the next artist is the same as the current artist, it displays the next tract title only; if the next artist is different than the current artist, it displays the next tract title and, in parentheses, the next artist.

Here is the code:

Code: [Select]
%s%t(10)%ac%?pn<Playlist: %pn|Dynamic Playlist>;
%?if(%ia, =, %Ia)<%t(10)%s%ac%?It<Next: %It|No Next Song>|%t(0)>;
%?if(%ia, !=, %Ia)<%t(10)%s%ac%?It<Next: %It %(%Ia%)|No Next Song>|%t(0)>

I doubt that's as efficient or as elegant as it could be, but it works.

I would like to add another conditional. If the next artist is the same as the current artist, but the album name is different, I would like to display the next tract title and, in brackets, the next album name.

That is, it would still have only two sublines, but the second (displaying the next song info) would display either the next track title only (if next artist and next album are the same as current) or the next track title and artist name (if next artist is different) or the next track title and album name (if next artist is the same but album is different).

I have tried several different methods, but I cannot get any to work. Could somebody help me out? Thanks.
Title: Re: Help with nested conditional sublines
Post by: JdGordon on November 17, 2011, 07:11:41 AM
You have a few options, the obvious two are:
1) make 2 viewports, one for when the artists are the same and one when they arent.
2) just add the conditionl in the line.. something like:
Code: [Select]
%?if(%ia, !=, %Ia)<%t(10)%s%ac%?if(%id, !=, %Id)<%Id> - %?It<Next: %It %(%Ia%)|No Next Song>|%t(0)>