[Feature] Skin engine Themes grab text from a file %ft(file, line)

allow the skin engine to read text files and return a particular line

you then can use ss on that string to allow display of strings from the file
(Playername comes to mind)

able to be used as conditional
%?ft(filename)<Found|Not Found>

if (selected) line of file is empty the tag is treated as #COMMENT

bugfix:
%t(n)%?x<text|text>
would ignore the specified timeout defaulting to 2 seconds

bugfix: cabbiev2.128x160x16.wps was missing %Sx()
for translation on 'Next Track:'

playername.txt generated at boot if it doesn't exist contents: 'Rockbox!'

Change-Id: I04ea4fd411f74c7c6e672657949aa520c2f86f95
This commit is contained in:
William Wilgus 2024-12-07 14:23:06 -05:00 committed by William Wilgus
parent 876e8c1305
commit eb3e5eb2bf
8 changed files with 122 additions and 8 deletions

View file

@ -36,6 +36,13 @@ This configuration entry can only be created and edited with a text editor or
the Main Menu Config Plugin (see \reference{ref:main_menu_config}).
It is not possible to change this setting via the settings menu.
\subsection{\label{ref:CustomisingThePlayername}Customising The Playername}
Some themes (Cabbiev2) show a customizable playername in the Whats Playing Screen.
Edit the first line of \fname{/.rockbox/playername.txt} to show your own message
or leave an empty file to disable the feature, deleting the file will generate a new
playername.txt file containing 'Rockbox!' next boot.
\subsection{\label{ref:OpenPlugins}Open Plugin Menu Items}
Rockbox allows you to choose a plugin to run for select menu options.

View file

@ -755,6 +755,21 @@ a horizontal progressbar which doesn't fill and draws the image
0 is the first conditional option
\end{description}
\begin{tagmap}
\config{\%ft(filename [,line]} & Get a line of text from a file.\\
\end{tagmap}
Use this tag to check for the existence of a file or read a line of text from a file.
Checking if a file exists can be done with \%?(ft(filename)<Found|NotFound>
similarly you can also check if a specific line exists with \%?(ft(filename, n)<Found|NotFound>
where n is the desired line.
Note: empty files or files that do not exist are ignored by the skin engine otherwise
\begin{description}
\item[filename] -- filename Note: files can only be found in \fname{/.rockbox} directory or one of its children.
eg. \%ft(wps/file.txt) would refer to \fname{/.rockbox/wps/file.txt}
\item[line] -- OPTIONAL, which line to grab, defaults to the first line.
Note: lines must end with CR or LF but may not exceed 320 characters
\end{description}
\begin{tagmap}
\config{\%(} & The character `('\\
\config{\%)} & The character `)'\\