Add viewports to the manual. Adapted from FS#9934 by Jonas Häggqvist and FS#10553...
[kugel-rb.git] / manual / appendix / wps_tags.tex
blob7c4fd5418a9c887f32bbf5cbe71f3f3bc6be756d
1 % $Id$ %
2 \chapter{\label{ref:wps_tags}WPS Tags}
3 \section{Status Bar}
4 \begin{table}
5 \begin{tagmap}{}{}
6 \config{\%we} & Display Status Bar\\
7 \config{\%wd} & Hide Status Bar\\
8 \end{tagmap}
9 \end{table}
10 These tags override the player setting for the display of the status bar.
11 They must be noted on their own line (which will not be shown in the WPS).
13 \section{Information from the track tags}
14 \begin{table}
15 \begin{tagmap}{}{}
16 \config{\%ia} & Artist\\
17 \config{\%ic} & Composer\\
18 \config{\%id} & Album Name\\
19 \config{\%ig} & Genre Name\\
20 \config{\%in} & Track Number\\
21 \config{\%it} & Track Title\\
22 \config{\%iv} & ID3 version (1.0, 1.1, 2.2, 2.3, 2.4, or empty if not an ID3 tag)\\
23 \config{\%iy} & Year\\
24 \end{tagmap}
25 \end{table}
26 Remember that this information is not always available, so use the
27 conditionals to show alternate information in preference to assuming.
29 These tags, when written with a capital ``I'' (e.g. \config{\%Ia} or \config{\%Ic}),
30 show the information for the next song to be played.
32 \nopt{lcd_charcell}{
33 \section{Viewports}
34 \begin{table}
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}\%C\%Vda{\textbar}\%Vdb{\textgreater}}
53 will show viewport 'a' if album art is found, and 'b' if it isn't.\\
54 \end{tagmap}
55 \end{table}
58 \section{Power Related Information}
59 \begin{table}
60 \begin{tagmap}{}{}
61 \config{\%bl} & Numeric battery level in percents\\
62 & Can also be used in a conditional:
63 \config{\%?bl{\textless}-1{\textbar}0{\textbar}1{\textbar}%
64 2{\textbar}\ldots{\textbar}N{\textgreater}},
65 where the value $-1$ is used when the battery level isn't
66 known (it usually is)\\
67 \config{\%bv} & The battery level in volts\\
68 \config{\%bt} & Estimated battery time left\\
69 \config{\%bp} & ``p'' if the charger is connected (only on targets
70 that can charge batteries)\\
71 \config{\%bc} & ``c'' if the unit is currently charging the battery (only on
72 targets that have software charge control or monitoring)\\
73 \config{\%bs} & Remaining time of the sleep timer (if it is set)\\
74 \end{tagmap}
75 \end{table}
77 \section{Information about the file}
78 \begin{table}
79 \begin{tagmap}{}{}
80 \config{\%fb} & File Bitrate (in kbps)\\
81 \config{\%fc} & File Codec (e.g. ``MP3'' or ``FLAC''). %
82 This tag can also be used in a conditional tag, %
83 \config{\%?fc{\textless}mp1\-{\textbar}mp2\-{\textbar}mp3\-%
84 {\textbar}aiff\-{\textbar}wav\-{\textbar}ogg\-{\textbar}flac\-%
85 {\textbar}mpc\-{\textbar}a52\-{\textbar}wavpack\-{\textbar}alac\-%
86 {\textbar}aac\-{\textbar}shn\-{\textbar}sid\-{\textbar}adx\-%
87 {\textbar}nsf\-{\textbar}speex\-{\textbar}spc\-{\textbar}ape\-%
88 {\textbar}wma\-{\textbar}mod\-{\textbar}sap%
89 {\textbar}unknown{\textgreater}}.\\
90 & The codec order is as follows: MP1, MP2, MP3, AIFF, WAV,
91 Ogg Vorbis (OGG), FLAC, MPC, AC3, WavPack (WV), ALAC, AAC,
92 Shorten (SHN), SID, ADX, NSF, Speex, SPC, APE, WMA, MOD, SAP.\\
93 \config{\%ff} & File Frequency (in Hz)\\
94 \config{\%fm} & File Name\\
95 \config{\%fn} & File Name (without extension)\\
96 \config{\%fp} & File Path\\
97 \config{\%fs} & File Size (in Kilobytes)\\
98 \config{\%fv} & ``(avg)'' if variable bit rate or empty string if constant bit rate\\
99 \config{\%d1} & First directory from the end of the file path\\
100 \config{\%d2} & Second directory from the end of the file path\\
101 \config{\%d3} & Third directory from the end of the file path\\
102 \end{tagmap}
103 \end{table}
104 Example for the \config{\%dN} commands: If the path is
105 ``/Rock/Kent/Isola/11 - 747.mp3'', \config{\%d1} is ``Isola'',
106 \config{\%d2} is ``Kent'' and \config{\%d3} is ``Rock''.
108 These tags, when written with the first letter capitalized (e.g. \config{\%Fn} or \config{\%D2}),
109 produce the information for the next file to be played.
111 \section{Playlist/Song Info}
112 \begin{table}
113 \begin{tagmap}{}{}
114 \config{\%pb} & Progress Bar\\
115 \opt{player}{
116 & This will display a one character ``cup''
117 that empties as the time progresses.}
118 \opt{lcd_bitmap}{
119 & This will replace the entire line with a progress bar. \\
120 & You can set the position, width and height of the progressbar %
121 (in pixels) and load a custom image for it: %
122 \config{\%pb{\textbar}image.bmp{\textbar}x{\textbar}y{\textbar}width{\textbar}height{\textbar}}} \\
123 \opt{player}{%
124 \config{\%pf} & Full-line progress bar \& time display\\
126 \config{\%px} & Percentage Played In Song\\
127 \config{\%pc} & Current Time In Song\\
128 \config{\%pe} & Total Number of Playlist Entries\\
129 \nopt{player}{%
130 \config{\%pm} & Peak Meter. The entire line is used as %
131 volume peak meter.\\%
133 \config{\%pn} & Playlist Name (without path or extension)\\
134 \config{\%pp} & Playlist Position\\
135 \config{\%pr} & Remaining Time In Song\\
136 \config{\%ps} & ``s'' if shuffle mode is enabled\\
137 \config{\%pt} & Total Track Time\\
138 \config{\%pv} & Current volume (in dB). Can also be used in a conditional: \\
139 & \config{\%?pv{\textless}0{\textbar}1{\textbar}2{\textbar}\ldots%
140 {\textbar}N{\textgreater}}\\
141 & 0 is used for mute, the last option is used for values greater than zero.\\
142 \end{tagmap}
143 \end{table}
145 \section{Runtime Database}
146 \begin{table}
147 \begin{tagmap}{}{}
148 \config{\%rp} & Song playcount\\
149 \config{\%rr} & Song rating (0-10). This tag can also be used in a conditional tag: %
150 \config{\%?rr{\textless}0{\textbar}1{\textbar}2{\textbar}3{\textbar}%
151 4{\textbar}5{\textbar}6{\textbar}7{\textbar}8{\textbar}9{\textbar}%
152 10{\textgreater}}\\
153 \end{tagmap}
154 \end{table}
156 \opt{swcodec}{
157 \section{Sound (DSP) settings}
158 \begin{table}
159 \begin{tagmap}{}{}
160 \config{\%Sp} & Current playback pitch \\
161 \opt{swcodec}{
162 \config{\%xf} & Crossfade setting, in the order: Off, Shuffle, Skip, Always\\
163 \config{\%rg} & ReplayGain value in use (x.y dB). If used as a conditional,
164 Replaygain type in use: \config{\%?rg{\textless}Off{\textbar}Track%
165 {\textbar}Album{\textbar}TrackShuffle{\textbar}AlbumShuffle%
166 {\textbar}No tag{\textgreater}}\\
168 \end{tagmap}
169 \end{table}
172 % this will not include the "remote hold switch" tag for targets lacking
173 % a main unit hold switch
174 \opt{hold_button}{
175 \opt{remote_button_hold}{
176 \section{Hold Switches}
177 \begin{table}
178 \begin{tagmap}{}{}
179 \config{\%mh} & ``h'' if the main unit hold switch is on\\
180 \config{\%mr} & ``r'' if the remote hold switch is on\\
181 \end{tagmap}
182 \end{table}
184 \nopt{remote_button_hold}{
185 \section{Hold Switch}
186 \begin{table}
187 \begin{tagmap}{}{}
188 \config{\%mh} & ``h'' if the hold switch is on\\
189 \end{tagmap}
190 \end{table}
194 \section{Virtual LED}
195 \begin{table}
196 \begin{tagmap}{}{}
197 \config{\%lh} & ``h'' if the \disk\ is accessed\\
198 \end{tagmap}
199 \end{table}
201 \section{Repeat Mode}
202 \begin{table}
203 \begin{tagmap}{}{}
204 \config{\%mm} & Repeat mode, 0-4, in the order: Off, All, One, Shuffle
205 \opt{player,recorder,recorderv2fm}{, A-B}\\
206 \end{tagmap}
207 \end{table}
208 Example: \config{\%?mm{\textless}Off{\textbar}All{\textbar}One{\textbar}Shuffle%
209 {\textbar}A-B{\textgreater}}
211 \section{Playback Mode Tags}
212 \begin{table}
213 \begin{tagmap}{}{}
214 \config{\%mp} & Play status, 0-4, in the order: Stop, Play, Pause,
215 Fast Forward, Rewind\\
216 \end{tagmap}
217 \end{table}
218 Example: \config{\%?mp{\textless}Stop{\textbar}Play{\textbar}Pause{\textbar}%
219 Ffwd{\textbar}Rew{\textgreater}}
221 \section{Changing Volume}
222 \begin{table}
223 \begin{tagmap}{}{}
224 \config{\%mv[t]} & ``v'' if the volume is being changed\\
225 \end{tagmap}
226 \end{table}
228 The tag produces the letter ``v'' while the volume is being changed and some
229 amount of time after that, i.e. after the volume button has been released. The
230 optional parameter \config{t} specifies that amount of time, in seconds. If it
231 is not specified, 1 second is assumed.
233 The tag can be used as the switch in a conditional tag to display different things
234 depending on whether the volume is being changed. It can produce neat effects
235 when used with conditional viewports.
237 Example: \config{\%?mv2.5{\textless}Volume changing{\textbar}\%pv{\textgreater}}
239 The example above will display the text ``Volume changing'' if the volume is
240 being changed and 2.5 secs after the volume button has been released. After
241 that, it will display the volume value.
243 \section{Settings}
244 \begin{table}
245 \begin{tagmap}{}{}
246 \config{\%St{\textbar}<setting name>{\textbar}} & The value of the Rockbox
247 setting with the specified name. See \reference{ref:config_file_options}
248 for the list of the available settings.\\
249 \end{tagmap}
250 \end{table}
252 Examples:
253 \begin{enumerate}
254 \item As a simple tag: \config{\%St{\textbar}skip length{\textbar}}
255 \item As a conditional: \config{\%?St{\textbar}eq enabled{\textbar}{\textless}Eq is enabled{\textbar}Eq is disabled{\textgreater}}
256 \end{enumerate}
259 \opt{lcd_bitmap}{
260 \section{\label{ref:wps_images}Images}
261 \begin{table}
262 \begin{tagmap}{}{}
263 \nopt{archos}{%
264 \config{\%X{\textbar}filename.bmp{\textbar}}
265 & Load and set a backdrop image for the WPS.
266 This image must be exactly the same size as your LCD.\\
268 \config{\%x{\textbar}n{\textbar}filename{\textbar}x{\textbar}y{\textbar}}
269 & Load and display an image\\
270 & \config{n}: image ID (a-z and A-Z) for later referencing in \config{\%xd}\\
271 & \config{filename}: file name relative to \fname{/.rockbox/} and including ``.bmp''\\
272 & \config{x}: x coordinate\\
273 & \config{y}: y coordinate.\\
274 \config{\%xl{\textbar}n{\textbar}filename{\textbar}x{\textbar}y{\textbar}[nimages{\textbar}]}
275 & Preload an image for later display (useful for when your images are displayed conditionally)\\
276 & \config{n}: image ID (a-z and A-Z) for later referencing in \config{\%xd}\\
277 & \config{filename}: file name relative to \fname{/.rockbox/} and including ``.bmp''\\
278 & \config{x}: x coordinate\\
279 & \config{y}: y coordinate\\
280 & \config{nimages}: (optional) number of sub-images (tiled vertically, of the same height)
281 contained in the bitmap. Default is 1.\\
282 \config{\%xdn[i]} & Display a preloaded image\\
283 & \config{n}: image ID (a-z and A-Z) as it was specified in \config{\%x} or \config{\%xl}\\
284 & \config{i}: (optional) number of the sub-image to display (a-z for 1-26 and A-Z for 27-52).
285 By default the first (i.e. top most) sub-image will be used.\\
286 \end{tagmap}
287 \end{table}
289 Examples:
290 \begin{enumerate}
291 \item Load and display the image \fname{/.rockbox/bg.bmp} with ID ``a'' at 37, 109:\\
292 \config{\%x{\textbar}a{\textbar}bg.bmp{\textbar}37{\textbar}109{\textbar}}
293 \item Load a bitmap strip containing 5 volume icon images (all the same size)
294 with image ID ``M'', and then reference the individual sub-images in a conditional:\\
295 \config{\%xl{\textbar}M{\textbar}volume.bmp{\textbar}134{\textbar}153{\textbar}5{\textbar}}\\
296 \config{\%?pv<\%xdMa{\textbar}\%xdMb{\textbar}\%xdMc{\textbar}\%xdMd{\textbar}%
297 \%xdMe>}
298 \end{enumerate}
301 \note{
302 \begin{itemize}
303 \item The images must be in BMP format
304 \item The image tag must be on its own line
305 \item The ID is case sensitive, giving 52 different ID's
306 \item The size of the LCD screen for each player varies. See table below
307 for appropriate sizes of each device. The x and y coordinates must
308 repect each of the players' limits.
309 \end{itemize}
313 \opt{albumart}{
314 \section{Album Art}
315 \begin{table}
316 \begin{tagmap}{}{}
317 \config{\%Cl{\textbar}x{\textbar}y{\textbar}[[l{\textbar}c{\textbar}r]maxwidth]{\textbar}[[t{\textbar}c{\textbar}b]maxheight]{\textbar}}
318 & Define the settings for albumart\\
319 & \config{x}: x coordinate\\
320 & \config{y}: y coordinate\\
321 & \config{maxwidth}: Maximum height\\
322 & \config{maxheight}: Maximum width\\
323 \config{\%C} & Display the album art as configured. This tag can also be used as a conditional.\\
324 \end{tagmap}
325 \end{table}
327 The picture will be rescaled, preserving aspect ratio to fit the given
328 \config{maxwidth} and \config{maxheight}. If the aspect ratio doesn't match the
329 configured values, the picture will be placed according to the flags to the
330 \config{maxwidth} and \config{maxheight} parameters:
331 \begin{itemize}
332 \item \config{maxwidth}:
333 \begin{description}
334 \item[\config{l}.] Align left
335 \item[\config{c}.] Align center (default)
336 \item[\config{r}.] Align right
337 \end{description}
338 \item \config{maxheight}:
339 \begin{description}
340 \item[\config{t}.] Align left
341 \item[\config{c}.] Align center (default)
342 \item[\config{b}.] Align right
343 \end{description}
344 \end{itemize}
346 Examples:
347 \begin{enumerate}
348 \item Load albumart at position 20,40 and display it without resizing:\\
349 \config{\%Cl{\textbar}20{\textbar}40{\textbar}{\textbar}{\textbar}}
350 \item Load albumart at position 0,20 and resize it to be at most 100x100
351 pixels. If the image isn't square, align it to the bottom-right
352 corner:\\
353 \config{\%CL{\textbar}0{\textbar}20{\textbar}r100{\textbar}b100{\textbar}}
354 \end{enumerate}
357 \section{Alignment}
358 \begin{table}
359 \begin{tagmap}{}{}
360 \config{\%al} & Align the text left\\
361 \config{\%ac} & Center the text\\
362 \config{\%ar} & Align the text right\\
363 \end{tagmap}
364 \end{table}
365 All alignment tags may be present in one line, but they need to be in the
366 order left -- center -- right. If the aligned texts overlap, they are merged.
368 \section{Conditional Tags}
370 \begin{table}
371 \begin{tagmap}{}{}
372 \config{\%?xx{\textless}true{\textbar}false{\textgreater}}
373 & If / Else: Evaluate for true or false case \\
374 \config{\%?xx{\textless}alt1{\textbar}alt2{\textbar}alt3{\textbar}\dots{\textbar}else{\textgreater}}
375 & Enumerations: Evaluate for first / second / third / \dots / last condition \\
376 \end{tagmap}
377 \end{table}
379 \section{Subline Tags}
381 \begin{table}
382 \begin{tagmap}{}{}
383 \config{\%t{\textless}time{\textgreater}}
384 & Set the subline display cycle time (\%t5 or \%t3.4 formats) \\
385 \config{;}
386 & Split items on a line into separate sublines \\
387 \end{tagmap}
388 \end{table}
390 Allows grouping of several items (sublines) onto one line, with the
391 display cycling round the defined sublines. See
392 \reference{ref:AlternatingSublines} for details.
395 \section{Time and Date}
396 \begin{table}
397 \begin{tagmap}{}{}
398 \opt{rtc}{
399 \config{\%cd} & Day of month\\
400 \config{\%ce} & Zero padded day of month\\
401 \config{\%cH} & Zero padded hour from 00 to 23 (24 hour format)\\
402 \config{\%ck} & Hour from 0 to 23 (24 hour format)\\
403 \config{\%cI} & Zero padded hour from 12 to 12 (am/pm format)\\
404 \config{\%cl} & Hour from 12 to 12 (am/pm format)\\
405 \config{\%cm} & Month\\
406 \config{\%cM} & Minutes\\
407 \config{\%cS} & Seconds\\
408 \config{\%cy} & 2-digit year\\
409 \config{\%cY} & 4-digit year\\
410 \config{\%cP} & Capital AM/PM\\
411 \config{\%cp} & Lowercase am/pm\\
412 \config{\%ca} & Weekday name\\
413 \config{\%cb} & Month name\\
414 \config{\%cu} & Day of week from 1 to 7, 1 is Monday\\
415 \config{\%cw} & Day of week from 0 to 6, 0 is Sunday\\
417 \config{\%cc} & Check for presence of the clock hardware\\
418 \end{tagmap}
419 \end{table}
420 The \%cc tag returns ``c'' if the necessary hardware is present and can also be
421 used as a conditional. This can be very useful for designing a WPS that works on
422 multiple targets, some with and some without a clock. By using this tag as a
423 conditional it is possible to display current date and time on those targets that
424 support this
425 \opt{rtc}{ (like the \playertype)},
426 or alternate information on those that do not
427 \nopt{rtc}{ (like the \playertype)}%
430 Example:
431 \config{\%?cc{\textless}\%cH:\%cM{\textbar}No clock detected{\textgreater}}
434 \section{Other Tags}
435 \begin{table}
436 \begin{tagmap}{}{}
437 \config{\%\%} & The character `\%'\\
438 \config{\%{\textless}} & The character `{\textless}'\\
439 \config{\%{\textbar}} & The character `{\textbar}'\\
440 \config{\%{\textgreater}} & The character `{\textgreater}'\\
441 \config{\%;} & The character `;'\\
442 \config{\%s} & Indicate that the line should scroll. Can occur
443 anywhere in a line (given that the text is
444 displayed; see conditionals above). You can specify
445 up to ten scrolling lines. Scrolling lines can not
446 contain dynamic content such as timers, peak meters
447 or progress bars.\\
448 \end{tagmap}
449 \end{table}