forked from len0rd/rockbox
Implement feature request FS#7476: Add a "song progress percentage" WPS tag (%px) that can be used in a conditional to create custom progress meters.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13987 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
ebc076bc15
commit
29407cbe80
5 changed files with 15 additions and 0 deletions
|
@ -848,6 +848,14 @@ static char *get_token_value(struct gui_wps *gwps,
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
|
|
||||||
|
case WPS_TOKEN_TRACK_ELAPSED_PERCENT:
|
||||||
|
if (intval)
|
||||||
|
{
|
||||||
|
*intval = limit * (id3->elapsed + state->ff_rewind_count) / id3->length + 1;
|
||||||
|
}
|
||||||
|
snprintf(buf, buf_size, "%d", 100*(id3->elapsed + state->ff_rewind_count) / id3->length);
|
||||||
|
return buf;
|
||||||
|
|
||||||
case WPS_TOKEN_METADATA_ARTIST:
|
case WPS_TOKEN_METADATA_ARTIST:
|
||||||
return id3->artist;
|
return id3->artist;
|
||||||
|
|
||||||
|
|
|
@ -222,6 +222,7 @@ enum wps_token_type {
|
||||||
WPS_TOKEN_VOLUME,
|
WPS_TOKEN_VOLUME,
|
||||||
|
|
||||||
/* Current track */
|
/* Current track */
|
||||||
|
WPS_TOKEN_TRACK_ELAPSED_PERCENT,
|
||||||
WPS_TOKEN_TRACK_TIME_ELAPSED,
|
WPS_TOKEN_TRACK_TIME_ELAPSED,
|
||||||
WPS_TOKEN_TRACK_TIME_REMAINING,
|
WPS_TOKEN_TRACK_TIME_REMAINING,
|
||||||
WPS_TOKEN_TRACK_LENGTH,
|
WPS_TOKEN_TRACK_LENGTH,
|
||||||
|
|
|
@ -242,6 +242,10 @@ static void dump_wps_tokens(struct wps_data *data)
|
||||||
snprintf(buf, sizeof(buf), "time elapsed in track");
|
snprintf(buf, sizeof(buf), "time elapsed in track");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WPS_TOKEN_TRACK_ELAPSED_PERCENT:
|
||||||
|
snprintf(buf, sizeof(buf), "played percentage of track");
|
||||||
|
break;
|
||||||
|
|
||||||
case WPS_TOKEN_PLAYLIST_ENTRIES:
|
case WPS_TOKEN_PLAYLIST_ENTRIES:
|
||||||
snprintf(buf, sizeof(buf), "number of entries in playlist");
|
snprintf(buf, sizeof(buf), "number of entries in playlist");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -247,6 +247,7 @@ static const struct wps_tag all_tags[] = {
|
||||||
|
|
||||||
{ WPS_TOKEN_VOLUME, "pv", WPS_REFRESH_DYNAMIC, NULL },
|
{ WPS_TOKEN_VOLUME, "pv", WPS_REFRESH_DYNAMIC, NULL },
|
||||||
|
|
||||||
|
{ WPS_TOKEN_TRACK_ELAPSED_PERCENT, "px", WPS_REFRESH_DYNAMIC, NULL },
|
||||||
{ WPS_TOKEN_TRACK_TIME_ELAPSED, "pc", WPS_REFRESH_DYNAMIC, NULL },
|
{ WPS_TOKEN_TRACK_TIME_ELAPSED, "pc", WPS_REFRESH_DYNAMIC, NULL },
|
||||||
{ WPS_TOKEN_TRACK_TIME_REMAINING, "pr", WPS_REFRESH_DYNAMIC, NULL },
|
{ WPS_TOKEN_TRACK_TIME_REMAINING, "pr", WPS_REFRESH_DYNAMIC, NULL },
|
||||||
{ WPS_TOKEN_TRACK_LENGTH, "pt", WPS_REFRESH_STATIC, NULL },
|
{ WPS_TOKEN_TRACK_LENGTH, "pt", WPS_REFRESH_STATIC, NULL },
|
||||||
|
|
|
@ -89,6 +89,7 @@ Example for the \config{\%dN} commands: If the path is
|
||||||
\opt{player}{%
|
\opt{player}{%
|
||||||
\config{\%pf} & Full-line progress bar \& time display\\
|
\config{\%pf} & Full-line progress bar \& time display\\
|
||||||
}%
|
}%
|
||||||
|
\config{\%px} & Percentage Played In Song\\
|
||||||
\config{\%pc} & Current Time In Song\\
|
\config{\%pc} & Current Time In Song\\
|
||||||
\config{\%pe} & Total Number of Playlist Entries\\
|
\config{\%pe} & Total Number of Playlist Entries\\
|
||||||
\nopt{player}{%
|
\nopt{player}{%
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue