Rockbox mail archive
Subject: Re: [PATCH] wps-display (was Re: Custom WPS)
From: Eric Linenberg (elinenbe_at_umich.edu)
JH> could you post it in a normal zip possibly? Cygwin is telling me that it's not
JH> a valid gzip file :)
JH> --- Magnus Holmgren <lear_at_algonet.se> wrote:
>> Justin Heiner wrote:
>> > The Custom WPS still has work that needs to be done with it. My reasoning
>> > behind having it enabled 100% now is that other people other than me will
>> > updating on it hopefully (brainstorming with Bagder and others for that
>> OK, I've just created a patch for wps-display.c, rewriting most of the
>> formatting code. I've added the MAD-style custom formatting, a few more
>> % commands and fixed the bug that wps.config wasn't always reloaded (I
>> think; I noticed the bug, but I haven't verified that the change works
>> as intended ;).
>> While I didn't copy the MAD code (which is GPL:ed), it did serve as an
>> important reference, and the implementation I've made uses pretty much
>> the same algorithm. So I added a comment about that, but I'm not sure
>> what is "proper" to do in a case like this.
>> The %-commands remain mostly the same. Some have been added, and a few
>> have been removed:
>> %% - Display a '%'
>> %< - Display a '<'
>> %| - Display a '|'
>> %> - Display a '>'
>> %s - Indicate that the line should scroll. Can occur anywhere in
>> a line (given that the text is displayed; see conditional
>> below). Only the first line with a %s will actually scroll.
>> %s is ignored if combined with %pb, %pc or %pr on the same
>> line (the result wouldn't be good anyway).
>> %?xx<|> - Conditional: if the tag specified by "xx" has a value, the
>> text between the "<" and the "|" is displayed, else the text
>> between the "|" and the ">" is displayed.
>> The else part is optional, so the "|" does not have to be
>> specified if no else part is desired. The conditionals nest,
>> so the text in the if and else part can contain all %
>> commands, including conditionals.
>> %ia - ID3 artist.
>> %id - ID3 disc/album.
>> &in - ID3 track number.
>> %it - ID3 track title.
>> %fb - Bit rate (in kbps).
>> %ff - Frequency (in Hz).
>> %fm - File name (with extension).
>> %fn - File name (without extension).
>> %fp - File path.
>> %fs - Fize size (in kB).
>> %pb - Progress bar char (Player only).
>> %pc - Current time in song.
>> %pe - Number of entries in playlist.
>> %pp - Position in playlist.
>> %pr - Remaining time in song.
>> %d1 - First directory from end of file path.
>> %d2 - Second directory from end of file path.
>> %d2 - Third directory from end of file path.
>> %fc and %fd are gone. They can mostly be emulated using %?<>. The
>> additional %-commands makes it possible to handle all WPS modes using
>> the format string.
>> Example for the the %dn commands: If the path is "/Rock/Kent/Isola/11 -
>> 747.mp3", %d1 is "Isola", %d2 is "Kent"... You get the picture.
>> A more complex example (and the wps.config I use now):
>> %s%?in<%in - >%?it<%it|%fn> %?ia<[%ia%?id<, %id>]>
>> That is, "tracknum - title [artist, album]", where most fields are only
>> displayed if available. Could also be rendered as "filename" or
>> "tracknum - title [artist]".
>> I think I've changed the semantics of wps_display/wps_refresh
>> slightly... wps_display now makes a full render of the display (so a
>> call to wps_refresh is not needed afterwards). When refresh_all in
>> wps_refresh is false, it only updates those lines that contains fields
>> that can change over time, such as play time. If refresh_all is true,
>> the entire display is rendered, including the scrolling line. wps.c
>> might need updates because of that, but it seems to work fine as it
>> is... :)
>> Note that I've only tested this on a player so far; I've no idea how
>> well it works on a recorder (at least it compiles). On recorders, it
>> needs to be able to handle fonts of different height in a better way (by
>> calculating the number that fits, depending on status bars, fonts,
>> > We've currently got only 64 characters per line on the Custom WPS, so
>> > commands are implented should be kept short and sweet.
>> I've removed that limitation. The format itself must (currently) fit
>> within 300 bytes. Formatting of a single line is done to a 256-byte
>> buffer (MAX_PATH actually), but that is of course only useful for the
>> scrolling line.
>> Magnus Holmgren
>> ATTACHMENT part 2 application/x-gzip name=wps-display.patch.gz
JH> Do You Yahoo!?
JH> Yahoo! Finance - Get real-time stock quotes
Page was last modified "Jan 10 2012" The Rockbox Crew