Correct album art alignment description error and spelling errors as pointed out...
[kugel-rb.git] / manual / appendix / wps_tags.tex
bloba092196de596edb2a15ea415c377ffb911dc7e0d
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, Auto Skip, Man Skip,
163 Shuffle, Shuffle and Man Skip, Always\\
164 \config{\%rg} & ReplayGain value in use (x.y dB). If used as a conditional,
165 Replaygain type in use: \config{\%?rg{\textless}Off{\textbar}Track%
166 {\textbar}Album{\textbar}TrackShuffle{\textbar}AlbumShuffle%
167 {\textbar}No tag{\textgreater}}\\
169 \end{tagmap}
170 \end{table}
173 % this will not include the "remote hold switch" tag for targets lacking
174 % a main unit hold switch
175 \opt{hold_button}{
176 \opt{remote_button_hold}{
177 \section{Hold Switches}
178 \begin{table}
179 \begin{tagmap}{}{}
180 \config{\%mh} & ``h'' if the main unit hold switch is on\\
181 \config{\%mr} & ``r'' if the remote hold switch is on\\
182 \end{tagmap}
183 \end{table}
185 \nopt{remote_button_hold}{
186 \section{Hold Switch}
187 \begin{table}
188 \begin{tagmap}{}{}
189 \config{\%mh} & ``h'' if the hold switch is on\\
190 \end{tagmap}
191 \end{table}
195 \section{Virtual LED}
196 \begin{table}
197 \begin{tagmap}{}{}
198 \config{\%lh} & ``h'' if the \disk\ is accessed\\
199 \end{tagmap}
200 \end{table}
202 \section{Repeat Mode}
203 \begin{table}
204 \begin{tagmap}{}{}
205 \config{\%mm} & Repeat mode, 0-4, in the order: Off, All, One, Shuffle
206 \opt{player,recorder,recorderv2fm}{, A-B}\\
207 \end{tagmap}
208 \end{table}
209 Example: \config{\%?mm{\textless}Off{\textbar}All{\textbar}One{\textbar}Shuffle%
210 {\textbar}A-B{\textgreater}}
212 \section{Playback Mode Tags}
213 \begin{table}
214 \begin{tagmap}{}{}
215 \config{\%mp} & Play status, 0-4, in the order: Stop, Play, Pause,
216 Fast Forward, Rewind\\
217 \end{tagmap}
218 \end{table}
219 Example: \config{\%?mp{\textless}Stop{\textbar}Play{\textbar}Pause{\textbar}%
220 Ffwd{\textbar}Rew{\textgreater}}
222 \section{Changing Volume}
223 \begin{table}
224 \begin{tagmap}{}{}
225 \config{\%mv[t]} & ``v'' if the volume is being changed\\
226 \end{tagmap}
227 \end{table}
229 The tag produces the letter ``v'' while the volume is being changed and some
230 amount of time after that, i.e. after the volume button has been released. The
231 optional parameter \config{t} specifies that amount of time, in seconds. If it
232 is not specified, 1 second is assumed.
234 The tag can be used as the switch in a conditional tag to display different things
235 depending on whether the volume is being changed. It can produce neat effects
236 when used with conditional viewports.
238 Example: \config{\%?mv2.5{\textless}Volume changing{\textbar}\%pv{\textgreater}}
240 The example above will display the text ``Volume changing'' if the volume is
241 being changed and 2.5 secs after the volume button has been released. After
242 that, it will display the volume value.
244 \section{Settings}
245 \begin{table}
246 \begin{tagmap}{}{}
247 \config{\%St{\textbar}<setting name>{\textbar}} & The value of the Rockbox
248 setting with the specified name. See \reference{ref:config_file_options}
249 for the list of the available settings.\\
250 \end{tagmap}
251 \end{table}
253 Examples:
254 \begin{enumerate}
255 \item As a simple tag: \config{\%St{\textbar}skip length{\textbar}}
256 \item As a conditional: \config{\%?St{\textbar}eq enabled{\textbar}{\textless}Eq is enabled{\textbar}Eq is disabled{\textgreater}}
257 \end{enumerate}
260 \opt{lcd_bitmap}{
261 \section{\label{ref:wps_images}Images}
262 \begin{table}
263 \begin{tagmap}{}{}
264 \nopt{archos}{%
265 \config{\%X{\textbar}filename.bmp{\textbar}}
266 & Load and set a backdrop image for the WPS.
267 This image must be exactly the same size as your LCD.\\
269 \config{\%x{\textbar}n{\textbar}filename{\textbar}x{\textbar}y{\textbar}}
270 & Load and display an image\\
271 & \config{n}: image ID (a-z and A-Z) for later referencing in \config{\%xd}\\
272 & \config{filename}: file name relative to \fname{/.rockbox/} and including ``.bmp''\\
273 & \config{x}: x coordinate\\
274 & \config{y}: y coordinate.\\
275 \config{\%xl{\textbar}n{\textbar}filename{\textbar}x{\textbar}y{\textbar}[nimages{\textbar}]}
276 & Preload an image for later display (useful for when your images are displayed conditionally)\\
277 & \config{n}: image ID (a-z and A-Z) for later referencing in \config{\%xd}\\
278 & \config{filename}: file name relative to \fname{/.rockbox/} and including ``.bmp''\\
279 & \config{x}: x coordinate\\
280 & \config{y}: y coordinate\\
281 & \config{nimages}: (optional) number of sub-images (tiled vertically, of the same height)
282 contained in the bitmap. Default is 1.\\
283 \config{\%xdn[i]} & Display a preloaded image\\
284 & \config{n}: image ID (a-z and A-Z) as it was specified in \config{\%x} or \config{\%xl}\\
285 & \config{i}: (optional) number of the sub-image to display (a-z for 1-26 and A-Z for 27-52).
286 By default the first (i.e. top most) sub-image will be used.\\
287 \end{tagmap}
288 \end{table}
290 Examples:
291 \begin{enumerate}
292 \item Load and display the image \fname{/.rockbox/bg.bmp} with ID ``a'' at 37, 109:\\
293 \config{\%x{\textbar}a{\textbar}bg.bmp{\textbar}37{\textbar}109{\textbar}}
294 \item Load a bitmap strip containing 5 volume icon images (all the same size)
295 with image ID ``M'', and then reference the individual sub-images in a conditional:\\
296 \config{\%xl{\textbar}M{\textbar}volume.bmp{\textbar}134{\textbar}153{\textbar}5{\textbar}}\\
297 \config{\%?pv<\%xdMa{\textbar}\%xdMb{\textbar}\%xdMc{\textbar}\%xdMd{\textbar}%
298 \%xdMe>}
299 \end{enumerate}
302 \note{
303 \begin{itemize}
304 \item The images must be in BMP format
305 \item The image tag must be on its own line
306 \item The ID is case sensitive, giving 52 different ID's
307 \item The size of the LCD screen for each player varies. See table below
308 for appropriate sizes of each device. The x and y coordinates must
309 repect each of the players' limits.
310 \end{itemize}
314 \opt{albumart}{
315 \section{Album Art}
316 \begin{table}
317 \begin{tagmap}{}{}
318 \config{\%Cl{\textbar}x{\textbar}y{\textbar}[[l{\textbar}c{\textbar}r]maxwidth]{\textbar}[[t{\textbar}c{\textbar}b]maxheight]{\textbar}}
319 & Define the settings for albumart\\
320 & \config{x}: x coordinate\\
321 & \config{y}: y coordinate\\
322 & \config{maxwidth}: Maximum height\\
323 & \config{maxheight}: Maximum width\\
324 \config{\%C} & Display the album art as configured. This tag can also be used as a conditional.\\
325 \end{tagmap}
326 \end{table}
328 The picture will be rescaled, preserving aspect ratio to fit the given
329 \config{maxwidth} and \config{maxheight}. If the aspect ratio doesn't match the
330 configured values, the picture will be placed according to the flags to the
331 \config{maxwidth} and \config{maxheight} parameters:
332 \begin{itemize}
333 \item \config{maxwidth}:
334 \begin{description}
335 \item[\config{l}.] Align left
336 \item[\config{c}.] Align centre (default)
337 \item[\config{r}.] Align right
338 \end{description}
339 \item \config{maxheight}:
340 \begin{description}
341 \item[\config{t}.] Align top
342 \item[\config{c}.] Align centre (default)
343 \item[\config{b}.] Align bottom
344 \end{description}
345 \end{itemize}
347 Examples:
348 \begin{enumerate}
349 \item Load albumart at position 20,40 and display it without resizing:\\
350 \config{\%Cl{\textbar}20{\textbar}40{\textbar}{\textbar}{\textbar}}
351 \item Load albumart at position 0,20 and resize it to be at most 100x100
352 pixels. If the image isn't square, align it to the bottom-right
353 corner:\\
354 \config{\%CL{\textbar}0{\textbar}20{\textbar}r100{\textbar}b100{\textbar}}
355 \end{enumerate}
358 \section{Alignment}
359 \begin{table}
360 \begin{tagmap}{}{}
361 \config{\%al} & Align the text left\\
362 \config{\%ac} & Centre the text\\
363 \config{\%ar} & Align the text right\\
364 \end{tagmap}
365 \end{table}
366 All alignment tags may be present in one line, but they need to be in the
367 order left -- centre -- right. If the aligned texts overlap, they are merged.
369 \section{Conditional Tags}
371 \begin{table}
372 \begin{tagmap}{}{}
373 \config{\%?xx{\textless}true{\textbar}false{\textgreater}}
374 & If / Else: Evaluate for true or false case \\
375 \config{\%?xx{\textless}alt1{\textbar}alt2{\textbar}alt3{\textbar}\dots{\textbar}else{\textgreater}}
376 & Enumerations: Evaluate for first / second / third / \dots / last condition \\
377 \end{tagmap}
378 \end{table}
380 \section{Subline Tags}
382 \begin{table}
383 \begin{tagmap}{}{}
384 \config{\%t{\textless}time{\textgreater}}
385 & Set the subline display cycle time (\%t5 or \%t3.4 formats) \\
386 \config{;}
387 & Split items on a line into separate sublines \\
388 \end{tagmap}
389 \end{table}
391 Allows grouping of several items (sublines) onto one line, with the
392 display cycling round the defined sublines. See
393 \reference{ref:AlternatingSublines} for details.
396 \section{Time and Date}
397 \begin{table}
398 \begin{tagmap}{}{}
399 \opt{rtc}{
400 \config{\%cd} & Day of month\\
401 \config{\%ce} & Zero padded day of month\\
402 \config{\%cH} & Zero padded hour from 00 to 23 (24 hour format)\\
403 \config{\%ck} & Hour from 0 to 23 (24 hour format)\\
404 \config{\%cI} & Zero padded hour from 12 to 12 (am/pm format)\\
405 \config{\%cl} & Hour from 12 to 12 (am/pm format)\\
406 \config{\%cm} & Month\\
407 \config{\%cM} & Minutes\\
408 \config{\%cS} & Seconds\\
409 \config{\%cy} & 2-digit year\\
410 \config{\%cY} & 4-digit year\\
411 \config{\%cP} & Capital AM/PM\\
412 \config{\%cp} & Lowercase am/pm\\
413 \config{\%ca} & Weekday name\\
414 \config{\%cb} & Month name\\
415 \config{\%cu} & Day of week from 1 to 7, 1 is Monday\\
416 \config{\%cw} & Day of week from 0 to 6, 0 is Sunday\\
418 \config{\%cc} & Check for presence of the clock hardware\\
419 \end{tagmap}
420 \end{table}
421 The \%cc tag returns ``c'' if the necessary hardware is present and can also be
422 used as a conditional. This can be very useful for designing a WPS that works on
423 multiple targets, some with and some without a clock. By using this tag as a
424 conditional it is possible to display current date and time on those targets that
425 support this
426 \opt{rtc}{ (like the \playertype)},
427 or alternate information on those that do not
428 \nopt{rtc}{ (like the \playertype)}%
431 Example:
432 \config{\%?cc{\textless}\%cH:\%cM{\textbar}No clock detected{\textgreater}}
435 \section{Other Tags}
436 \begin{table}
437 \begin{tagmap}{}{}
438 \config{\%\%} & The character `\%'\\
439 \config{\%{\textless}} & The character `{\textless}'\\
440 \config{\%{\textbar}} & The character `{\textbar}'\\
441 \config{\%{\textgreater}} & The character `{\textgreater}'\\
442 \config{\%;} & The character `;'\\
443 \config{\%s} & Indicate that the line should scroll. Can occur
444 anywhere in a line (given that the text is
445 displayed; see conditionals above). You can specify
446 up to ten scrolling lines. Scrolling lines can not
447 contain dynamic content such as timers, peak meters
448 or progress bars.\\
449 \end{tagmap}
450 \end{table}