Rockbox General > Rockbox General Discussion

Help with this code

(1/1)

Elaphe:
This code shows the number of the track currently playing and toggles to the name of the next track in the list after 10 seconds.


--- Code: ---%ac%t(10.0)Track: %?in<%in|N/A>;%t(10.0)%ac%sNext: %?It<%It|%Fn>
--- End code ---

Is there a way to disable the toggle when the last track is reached? I mean, there's no point then to display: "Next:" or "Next: nothing".

[Saint]:
Its...some form of theme guy...to the rescue!


--- Quote from: Elaphe on September 03, 2014, 05:13:25 PM ---This code shows the number of the track currently playing and toggles to the name of the next track in the list after 10 seconds.


--- Code: ---%ac%t(10.0)Track: %?in<%in|N/A>;%t(10.0)%ac%sNext: %?It<%It|%Fn>
--- End code ---

Is there a way to disable the toggle when the last track is reached? I mean, there's no point then to display: "Next:" or "Next: nothing".

--- End quote ---

We can cheat here, somewhat. We can detect if there is a next track present in a roundabout way, by checking to see if it has a file name. Obviously you won't want the sublines to cycle a blank line either, so there's going to be a slight amount of code duplication, but, we can live with that.


--- Code: ---%ac%s%?Fn<%t(10.0)Track: %?in<%in|N/A>;%t(10.0)Next: %?It<%It|%Fn>|Track: %?in<%in|N/A>>
--- End code ---

Let me know if you have any further questions, be it regarding the above syntax or otherwise.


[Saint]

Elaphe:
Thanx a lot. It works perfectly.

Navigation

[0] Message Index

Go to full version