0b4c5f3e6e36f24a44b56376969b5821a84773c7
[kugel-rb.git] / manual / appendix / wps_tags.tex
blob0b4c5f3e6e36f24a44b56376969b5821a84773c7
1 % $Id$ %
2 \chapter{\label{ref:wps_tags}WPS Tags}
3 \section{Status Bar}
4 \begin{tagmap}
5 \config{\%we} & Display Status Bar\\
6 \config{\%wd} & Hide Status Bar\\
7 \config{\%wi} & Display the inbuilt Status Bar in the current viewport\\
8 \end{tagmap}
9 These tags override the player setting for the display of the status bar.
10 They must be noted on their own line (which will not be shown in the WPS).
12 \section{Information from the track tags}
13 \begin{tagmap}
14 \config{\%ia} & Artist\\
15 \config{\%ic} & Composer\\
16 \config{\%iA} & Album Artist\\
17 \config{\%id} & Album Name\\
18 \config{\%iG} & Grouping\\
19 \config{\%ig} & Genre Name\\
20 \config{\%in} & Track Number\\
21 \config{\%it} & Track Title\\
22 \config{\%iC} & Comment\\
23 \config{\%iv} & ID3 version (1.0, 1.1, 2.2, 2.3, 2.4, or empty if not an ID3 tag)\\
24 \config{\%iy} & Year\\
25 \config{\%ik} & Disc Number\\
26 \end{tagmap}
27 Remember that this information is not always available, so use the
28 conditionals to show alternate information in preference to assuming.
30 These tags, when written with a capital ``I'' (e.g. \config{\%Ia} or \config{\%Ic}),
31 show the information for the next song to be played.
33 \nopt{lcd_charcell}{
34 \section{Viewports}
35 \begin{tagmap}
36 \nopt{lcd_non-mono}{%
37 \config{\%V{\textbar}x{\textbar}y{\textbar}[width]{\textbar}%
38 [height]{\textbar}[font]{\textbar}}
39 & See section \ref{ref:Viewports}\\}
41 \nopt{lcd_color}{\opt{lcd_non-mono}{%
42 \config{\%V{\textbar}x{\textbar}y{\textbar}[width]{\textbar}%
43 [height]{\textbar}[font]{\textbar}[fgshade]{\textbar}[bgshade]{\textbar}}
44 & See section \ref{ref:Viewports}\\}}
46 \opt{lcd_color}{%
47 \config{\%V{\textbar}x{\textbar}y{\textbar}[width]{\textbar}%
48 [height]{\textbar}[font]{\textbar}[fgcolour]{\textbar}[bgcolour]{\textbar}}
49 & See section \ref{ref:Viewports}\\}
51 \config{\%Vd'identifier'} & Display the `identifier' viewport. E.g.
52 \config{\%?C{\textless}\%Vda{\textbar}\%Vdb{\textgreater}}
53 will show viewport `a' if album art is found, and `b' if it isn't.\\
54 \end{tagmap}
57 \section{Power Related Information}
58 \begin{tagmap}
59 \config{\%bl} & Numeric battery level in percents\\
60 & Can also be used in a conditional:
61 \config{\%?bl{\textless}-1{\textbar}0{\textbar}1{\textbar}%
62 2{\textbar}\ldots{\textbar}N{\textgreater}},
63 where the value $-1$ is used when the battery level isn't
64 known (it usually is)\\
65 \config{\%bv} & The battery level in volts\\
66 \config{\%bt} & Estimated battery time left\\
67 \config{\%bp} & ``p'' if the charger is connected (only on targets
68 that can charge batteries)\\
69 \config{\%bc} & ``c'' if the unit is currently charging the battery (only on
70 targets that have software charge control or monitoring)\\
71 \config{\%bs} & Remaining time of the sleep timer (if it is set)\\
72 \end{tagmap}
74 \section{Information about the file}
75 \begin{tagmap}
76 \config{\%fb} & File Bitrate (in kbps)\\
77 \config{\%fc} & File Codec (e.g. ``MP3'' or ``FLAC''). %
78 This tag can also be used in a conditional tag, %
79 \config{\%?fc{\textless}mp1\-{\textbar}mp2\-{\textbar}mp3\-%
80 {\textbar}aiff\-{\textbar}wav\-{\textbar}ogg\-{\textbar}flac\-%
81 {\textbar}mpc\-{\textbar}a52\-{\textbar}wavpack\-{\textbar}alac\-%
82 {\textbar}aac\-{\textbar}shn\-{\textbar}sid\-{\textbar}adx\-%
83 {\textbar}nsf\-{\textbar}speex\-{\textbar}spc\-{\textbar}ape\-%
84 {\textbar}wma\-{\textbar}mod\-{\textbar}sap%
85 {\textbar}unknown{\textgreater}}.\\
86 & The codec order is as follows: MP1, MP2, MP3, AIFF, WAV,
87 Ogg Vorbis (OGG), FLAC, MPC, AC3, WavPack (WV), ALAC, AAC,
88 Shorten (SHN), SID, ADX, NSF, Speex, SPC, APE, WMA, MOD, SAP.\\
89 \config{\%ff} & File Frequency (in Hz)\\
90 \config{\%fk} & File Frequency (in kHz)\\
91 \config{\%fm} & File Name\\
92 \config{\%fn} & File Name (without extension)\\
93 \config{\%fp} & File Path\\
94 \config{\%fs} & File Size (in Kilobytes)\\
95 \config{\%fv} & ``(avg)'' if variable bit rate or empty string if constant bit rate\\
96 \config{\%d1} & First directory from the end of the file path\\
97 \config{\%d2} & Second directory from the end of the file path\\
98 \config{\%d3} & Third directory from the end of the file path\\
99 \end{tagmap}
100 Example for the \config{\%dN} commands: If the path is
101 ``/Rock/Kent/Isola/11 - 747.mp3'', \config{\%d1} is ``Isola'',
102 \config{\%d2} is ``Kent'' and \config{\%d3} is ``Rock''.
104 These tags, when written with the first letter capitalized (e.g. \config{\%Fn} or \config{\%D2}),
105 produce the information for the next file to be played.
107 \section{Playlist/Song Info}
108 \begin{tagmap}
109 \config{\%pb} & Progress Bar\\
110 \opt{player}{
111 & This will display a one character ``cup''
112 that empties as the time progresses.}
113 \opt{lcd_bitmap}{
114 & This will replace the entire line with a progress bar. \\
115 & You can set the position, width and height of the progressbar %
116 (in pixels) and load a custom image for it: %
117 \config{\%pb{\textbar}image.bmp{\textbar}x{\textbar}y{\textbar}width{\textbar}height{\textbar}}} \\
118 \opt{player}{%
119 \config{\%pf} & Full-line progress bar \& time display\\
121 \config{\%px} & Percentage Played In Song\\
122 \config{\%pc} & Current Time In Song\\
123 \config{\%pe} & Total Number of Playlist Entries\\
124 \nopt{player}{%
125 \config{\%pm} & Peak Meter. The entire line is used as %
126 volume peak meter.\\%
128 \config{\%pn} & Playlist Name (without path or extension)\\
129 \config{\%pp} & Playlist Position\\
130 \config{\%pr} & Remaining Time In Song\\
131 \config{\%ps} & ``s'' if shuffle mode is enabled\\
132 \config{\%pt} & Total Track Time\\
133 \config{\%pv} & Current volume (in dB). Can also be used in a conditional: \\
134 & \config{\%?pv{\textless}0{\textbar}1{\textbar}2{\textbar}\ldots%
135 {\textbar}N{\textgreater}}\\
136 & 0 is used for mute, the last option is used for values greater than zero.\\
137 \config{\%pS} & Track is starting. An optional number gives how many seconds
138 the tag remains true for after the start of the track. The default is
139 10 seconds if no number is specified.\\
140 & \config{\%pS7{\textless}in the first 7 seconds of track{\textbar}in
141 the rest of the track{\textgreater}}\\
142 \config{\%pE} & Track is ending. An optional number gives how many seconds
143 before the end of the track the tag becomes true. The default is
144 10 seconds if no number is specified.\\
145 & \config{\%pE7{\textless}in the last 7 seconds of track{\textbar}in
146 the rest of the track{\textgreater}}\\
147 \config{\%Sp} & Current Playback Pitch\\
148 \end{tagmap}
150 \section{Runtime Database}
151 \begin{tagmap}
152 \config{\%rp} & Song playcount\\
153 \config{\%rr} & Song rating (0-10). This tag can also be used in a conditional tag: %
154 \config{\%?rr{\textless}0{\textbar}1{\textbar}2{\textbar}3{\textbar}%
155 4{\textbar}5{\textbar}6{\textbar}7{\textbar}8{\textbar}9{\textbar}%
156 10{\textgreater}}\\
157 \config{\%ra} & Autoscore for the song\\
158 \end{tagmap}
160 \opt{swcodec}{
161 \section{Sound (DSP) settings}
162 \begin{tagmap}
163 \config{\%Sp} & Current playback pitch \\
164 \opt{swcodec}{
165 \config{\%xf} & Crossfade setting, in the order: Off, Auto Skip, Man Skip,
166 Shuffle, Shuffle and Man Skip, Always\\
167 \config{\%rg} & ReplayGain value in use (x.y~dB). If used as a conditional,
168 Replaygain type in use: \config{\%?rg{\textless}Off{\textbar}Track%
169 {\textbar}Album{\textbar}TrackShuffle{\textbar}AlbumShuffle%
170 {\textbar}No tag{\textgreater}}\\
172 \end{tagmap}
175 % this will not include the "remote hold switch" tag for targets lacking
176 % a main unit hold switch
177 \opt{hold_button}{
178 \opt{remote_button_hold}{
179 \section{Hold Switches}
180 \begin{tagmap}
181 \config{\%mh} & ``h'' if the main unit hold switch is on\\
182 \config{\%mr} & ``r'' if the remote hold switch is on\\
183 \end{tagmap}
185 \nopt{remote_button_hold}{
186 \section{Hold Switch}
187 \begin{tagmap}
188 \config{\%mh} & ``h'' if the hold switch is on\\
189 \end{tagmap}
193 \section{Virtual LED}
194 \begin{tagmap}
195 \config{\%lh} & ``h'' if the \disk\ is accessed\\
196 \end{tagmap}
198 \section{Repeat Mode}
199 \begin{tagmap}
200 \config{\%mm} & Repeat mode, 0-4, in the order: Off, All, One, Shuffle, A-B\\
201 \end{tagmap}
202 Example: \config{\%?mm{\textless}Off{\textbar}All{\textbar}One{\textbar}Shuffle%
203 {\textbar}A-B{\textgreater}}
205 \section{Playback Mode}
206 \begin{tagmap}
207 \config{\%mp} & Play status, 0-4, in the order: Stop, Play, Pause,
208 Fast Forward, Rewind, Recording, Recording paused, FM Radio playing,
209 FM Radio muted\\
210 \end{tagmap}
211 Example: \config{\%?mp{\textless}Stop{\textbar}Play{\textbar}Pause{\textbar}%
212 Ffwd{\textbar}Rew{\textbar}Rec{\textbar}Rec pause{\textbar}FM{\textbar}%
213 FM pause{\textgreater}}
215 \section{Current Screen}
216 \begin{tagmap}
217 \config{\%cs} & The current screen, 1-5, in the order:
218 Menus, WPS, Recording screen, FM Radio screen, Current Playlist screen\\
219 \end{tagmap}
220 The tag can also be used as the switch in a conditional tag. For players without
221 some capabilities (e.g. having no FM radio) some values will be never yielded.
223 Example: \config{You are in the \%?cs{\textless}Main menu{\textbar}WPS{\textbar}%
224 Recording screen{\textbar}FM Radio screen{\textgreater}}
226 \section{List Title (\fname{.sbs} only)}
227 \begin{tagmap}
228 \config{\%Lt} & Title text. Should be used in a conditional so that non-list
229 screens don't show a title when they shouldn't\\
230 \config{\%Li} & Title icon. This uses the same order as custom icons (see
231 \wikilink{CustomIcons} in the wiki) except that here \config{0} is ``no
232 icon''\\
233 \end{tagmap}
235 This tag can be used to give custom formatting to list titles.
236 Define a viewport with the font and formatting desired, and then use
237 \config{\%?Lt{\textless}\%Lt{\textgreater}} to display the title within the
238 viewport. If \config{\%Lt} is present anywhere in the \fname{.sbs}, then the
239 \config{\%Vi} viewport will not show the title.
241 \section{Changing Volume}
242 \begin{tagmap}
243 \config{\%mv[t]} & ``v'' if the volume is being changed\\
244 \end{tagmap}
246 The tag produces the letter ``v'' while the volume is being changed and some
247 amount of time after that, i.e. after the volume button has been released. The
248 optional parameter \config{t} specifies that amount of time, in seconds. If it
249 is not specified, 1 second is assumed.
251 The tag can be used as the switch in a conditional tag to display different things
252 depending on whether the volume is being changed. It can produce neat effects
253 when used with conditional viewports.
255 Example: \config{\%?mv2.5{\textless}Volume changing{\textbar}\%pv{\textgreater}}
257 The example above will display the text ``Volume changing'' if the volume is
258 being changed and 2.5 seconds after the volume button has been released. After
259 that, it will display the volume value.
261 \section{Settings}
262 \begin{tagmap}
263 \config{\%St{\textbar}<setting name>{\textbar}} & The value of the Rockbox
264 setting with the specified name. See \reference{ref:config_file_options}
265 for the list of the available settings.\\
266 \end{tagmap}
268 Examples:
269 \begin{enumerate}
270 \item As a simple tag: \config{\%St{\textbar}skip length{\textbar}}
271 \item As a conditional: \config{\%?St{\textbar}eq enabled{\textbar}{\textless}Eq is enabled{\textbar}Eq is disabled{\textgreater}}
272 \end{enumerate}
275 \opt{lcd_bitmap}{
276 \section{\label{ref:wps_images}Images}
277 \begin{tagmap}
278 \nopt{archos}{%
279 \config{\%X{\textbar}filename.bmp{\textbar}}
280 & Load and set a backdrop image for the WPS.
281 This image must be exactly the same size as your LCD.\\
283 \config{\%x{\textbar}n{\textbar}filename{\textbar}x{\textbar}y{\textbar}}
284 & Load and display an image\\
285 & \config{n}: image ID (a-z and A-Z) for later referencing in \config{\%xd}\\
286 & \config{filename}: file name relative to \fname{/.rockbox/} and including ``.bmp''\\
287 & \config{x}: x coordinate\\
288 & \config{y}: y coordinate.\\
289 \config{\%xl{\textbar}n{\textbar}filename{\textbar}x{\textbar}y{\textbar}[nimages{\textbar}]}
290 & Preload an image for later display (useful for when your images are displayed conditionally)\\
291 & \config{n}: image ID (a-z and A-Z) for later referencing in \config{\%xd}\\
292 & \config{filename}: file name relative to \fname{/.rockbox/} and including ``.bmp''\\
293 & \config{x}: x coordinate\\
294 & \config{y}: y coordinate\\
295 & \config{nimages}: (optional) number of sub-images (tiled vertically, of the same height)
296 contained in the bitmap. Default is 1.\\
297 \config{\%xdn[i]} & Display a preloaded image\\
298 & \config{n}: image ID (a-z and A-Z) as it was specified in \config{\%x} or \config{\%xl}\\
299 & \config{i}: (optional) number of the sub-image to display (a-z for 1-26 and A-Z for 27-52).
300 By default the first (i.e. top most) sub-image will be used.\\
301 \end{tagmap}
303 Examples:
304 \begin{enumerate}
305 \item Load and display the image \fname{/.rockbox/bg.bmp} with ID ``a'' at 37, 109:\\
306 \config{\%x{\textbar}a{\textbar}bg.bmp{\textbar}37{\textbar}109{\textbar}}
307 \item Load a bitmap strip containing 5 volume icon images (all the same size)
308 with image ID ``M'', and then reference the individual sub-images in a conditional:\\
309 \config{\%xl{\textbar}M{\textbar}volume.bmp{\textbar}134{\textbar}153{\textbar}5{\textbar}}\\
310 \config{\%?pv<\%xdMa{\textbar}\%xdMb{\textbar}\%xdMc{\textbar}\%xdMd{\textbar}%
311 \%xdMe>}
312 \end{enumerate}
315 \note{
316 \begin{itemize}
317 \item The images must be in BMP format
318 \item The image tag must be on its own line
319 \item The ID is case sensitive, giving 52 different ID's
320 \item The size of the LCD screen for each player varies. See table below
321 for appropriate sizes of each device. The x and y coordinates must
322 repect each of the players' limits.
323 \end{itemize}
327 \opt{albumart}{
328 \section{Album Art}
329 \begin{tagmap}
330 \config{\%Cl{\textbar}x{\textbar}y{\textbar}[[l{\textbar}c{\textbar}r]maxwidth]{\textbar}[[t{\textbar}c{\textbar}b]maxheight]{\textbar}}
331 & Define the settings for albumart\\
332 & \config{x}: x coordinate\\
333 & \config{y}: y coordinate\\
334 & \config{maxwidth}: Maximum height\\
335 & \config{maxheight}: Maximum width\\
336 \config{\%C} & Display the album art as configured. This tag can also be used as a conditional.\\
337 \end{tagmap}
339 The picture will be rescaled, preserving aspect ratio to fit the given
340 \config{maxwidth} and \config{maxheight}. If the aspect ratio doesn't match the
341 configured values, the picture will be placed according to the flags to the
342 \config{maxwidth} and \config{maxheight} parameters:
343 \begin{itemize}
344 \item \config{maxwidth}:
345 \begin{description}
346 \item[\config{l}.] Align left
347 \item[\config{c}.] Align centre (default)
348 \item[\config{r}.] Align right
349 \end{description}
350 \item \config{maxheight}:
351 \begin{description}
352 \item[\config{t}.] Align top
353 \item[\config{c}.] Align centre (default)
354 \item[\config{b}.] Align bottom
355 \end{description}
356 \end{itemize}
358 Examples:
359 \begin{enumerate}
360 \item Load albumart at position 20,40 and display it without resizing:\\
361 \config{\%Cl{\textbar}20{\textbar}40{\textbar}{\textbar}{\textbar}}
362 \item Load albumart at position 0,20 and resize it to be at most 100x100
363 pixels. If the image isn't square, align it to the bottom-right
364 corner:\\
365 \config{\%CL{\textbar}0{\textbar}20{\textbar}r100{\textbar}b100{\textbar}}
366 \end{enumerate}
369 \section{Alignment}
370 \begin{tagmap}
371 \config{\%al} & Align the text left\\
372 \config{\%aL} & Align the text left, or to the right if RTL language is in use\\
373 \config{\%ac} & Centre the text\\
374 \config{\%ar} & Align the text right\\
375 \config{\%aR} & Align the text right, or to the left if RTL language is in use\\
376 \end{tagmap}
377 All alignment tags may be present in one line, but they need to be in the
378 order left -- centre -- right. If the aligned texts overlap, they are merged.
380 \section{Conditional Tags}
382 \begin{tagmap}
383 \config{\%?xx{\textless}true{\textbar}false{\textgreater}}
384 & If / Else: Evaluate for true or false case \\
385 \config{\%?xx{\textless}alt1{\textbar}alt2{\textbar}alt3{\textbar}\dots{\textbar}else{\textgreater}}
386 & Enumerations: Evaluate for first / second / third / \dots / last condition \\
387 \end{tagmap}
389 \section{Subline Tags}
391 \begin{tagmap}
392 \config{\%t{\textless}time{\textgreater}}
393 & Set the subline display cycle time (\%t5 or \%t3.4 formats) \\
394 \config{;}
395 & Split items on a line into separate sublines \\
396 \end{tagmap}
398 Allows grouping of several items (sublines) onto one line, with the
399 display cycling round the defined sublines. See
400 \reference{ref:AlternatingSublines} for details.
403 \section{Time and Date}
404 \begin{tagmap}
405 \opt{rtc}{
406 \config{\%cd} & Day of month from 01 to 31\\
407 \config{\%ce} & Zero padded day of month from 1 to 31\\
408 \config{\%cf} & A conditional for 12/24 hour format. \%?cf{\textless}24 hour stuff{\textbar}12 hour stuff{\textgreater}\\
409 \config{\%cH} & Zero padded hour from 00 to 23 (24 hour format)\\
410 \config{\%ck} & Hour from 0 to 23 (24 hour format)\\
411 \config{\%cI} & Zero padded hour from 01 to 12 (am/pm format)\\
412 \config{\%cl} & Hour from 1 to 12 (am/pm format)\\
413 \config{\%cm} & Month from 01 to 12\\
414 \config{\%cM} & Minutes\\
415 \config{\%cS} & Seconds\\
416 \config{\%cy} & 2-digit year\\
417 \config{\%cY} & 4-digit year\\
418 \config{\%cP} & Capital AM/PM\\
419 \config{\%cp} & Lowercase am/pm\\
420 \config{\%ca} & Weekday name\\
421 \config{\%cb} & Month name\\
422 \config{\%cu} & Day of week from 1 to 7, 1 is Monday\\
423 \config{\%cw} & Day of week from 0 to 6, 0 is Sunday\\
425 \config{\%cc} & Check for presence of the clock hardware\\
426 \end{tagmap}
427 The \%cc tag returns ``c'' if the necessary hardware is present and can also be
428 used as a conditional. This can be very useful for designing a WPS that works on
429 multiple targets, some with and some without a clock. By using this tag as a
430 conditional it is possible to display current date and time on those targets that
431 support this
432 \opt{rtc}{ (like the \playertype)},
433 or alternate information on those that do not
434 \nopt{rtc}{ (like the \playertype)}%
437 Example:
438 \config{\%?cc{\textless}\%cH:\%cM{\textbar}No clock detected{\textgreater}}
440 \section{Text Translation}
441 \begin{tagmap}
442 \config{\%Sx{\textbar}{\textless}English{\textgreater}{\textbar}}
443 & Display the translation of ``English'' in the current language\\
444 \end{tagmap}
446 \begin{itemize}
447 \item ``English'' must be a phrase used in the language file.
448 \item It should match the \config{Source:} line in the language file.
449 \end{itemize}
451 \note{checkwps cannot verify that the string is correct, so please check on
452 either the simulator or on target.}
455 \opt{touchscreen}{
456 \section{Touchscreen Areas (WPS only)}
457 \begin{tagmap}
458 \config{\%T{\textbar}x{\textbar}y{\textbar}width{\textbar}height%
459 {\textbar}action{\textbar}}
460 & Invoke the action specified when the user presses in the defined
461 touchscreen area.\\
462 \end{tagmap}
463 If the action starts with \& then the area must be held. Possible actions are:
465 \begin{description}
466 \item[play] -- Play/pause playback.
467 \item[stop] -- Stop playback and exit the WPS.
468 \item[prev] -- Previous track.
469 \item[next] -- Next track.
470 \item[ffwd] -- Seek forwards in the track.
471 \item[rwd] -- Seek backwards in the track.
472 \item[menu] -- Go to the main menu.
473 \item[browse] -- Go back to the file browser or database.
474 \item[shuffle] -- Toggle shuffle mode.
475 \item[repmode] -- Cycle through the repeat modes.
476 \item[quickscreen] -- Go to the quickscreen.
477 \item[contextmenu] -- Open the context menu.
478 \item[playlist] -- Go to the playlist viewer.
479 \item[progressbar] -- Seek to the appropriate position in the track based on the touch.
480 \item[volume] -- Set the volume to the appropriate level based on the touch.
481 \item[pitch] -- Open the pitchscreen.
482 \item[voldown] -- Decrease the volume by one step.
483 \item[volup] -- Increase the volume by one step.
484 \end{description}
486 \section{Last Touchscreen Press (WPS only)}
487 \begin{tagmap}
488 \config{\%Tl} & Indicates that the touchscreen is pressed.\\
489 \end{tagmap}
490 This tag can be used to display text or images or a viewport when the
491 touchscreen is pressed (like an On Screen Display). If you put a number
492 straight after \%Tl it will be used as a timeout in seconds
493 (e.g \%Tl2.5 will give a 2.5 second timeout) between the touchscreen press
494 being released and the tag going false. If no number is specified it will
495 use a 1 second timeout. It can also be used as a conditional, and can be
496 used with conditional viewports.
499 \section{Other Tags}
500 \begin{tagmap}
501 \config{\%\%} & The character `\%'\\
502 \config{\%{\textless}} & The character `{\textless}'\\
503 \config{\%{\textbar}} & The character `{\textbar}'\\
504 \config{\%{\textgreater}} & The character `{\textgreater}'\\
505 \config{\%;} & The character `;'\\
506 \config{\%s} & Indicate that the line should scroll. Can occur
507 anywhere in a line (given that the text is
508 displayed; see conditionals above). You can specify
509 up to ten scrolling lines. Scrolling lines can not
510 contain dynamic content such as timers, peak meters
511 or progress bars.\\
512 \end{tagmap}