summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-07-25 14:14:47 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-07-25 14:14:47 +0000
commit29407cbe801bfdfbe59ad0e40be8fc8ced4ac778 (patch)
treee38a41314519fb9e8ea8041668f7a0623c0be893 /apps
parentebc076bc15d6501674b9db772557a0eadfb4a5e2 (diff)
downloadrockbox-29407cbe801bfdfbe59ad0e40be8fc8ced4ac778.tar.gz
rockbox-29407cbe801bfdfbe59ad0e40be8fc8ced4ac778.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/gwps-common.c8
-rw-r--r--apps/gui/gwps.h1
-rw-r--r--apps/gui/wps_debug.c4
-rw-r--r--apps/gui/wps_parser.c1
4 files changed, 14 insertions, 0 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index e5f0e882e8..62d710af54 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -848,6 +848,14 @@ static char *get_token_value(struct gui_wps *gwps,
}
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:
return id3->artist;
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h
index cfa7e70714..371b2b0399 100644
--- a/apps/gui/gwps.h
+++ b/apps/gui/gwps.h
@@ -222,6 +222,7 @@ enum wps_token_type {
WPS_TOKEN_VOLUME,
/* Current track */
+ WPS_TOKEN_TRACK_ELAPSED_PERCENT,
WPS_TOKEN_TRACK_TIME_ELAPSED,
WPS_TOKEN_TRACK_TIME_REMAINING,
WPS_TOKEN_TRACK_LENGTH,
diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c
index 317e73cf2a..0f40a57801 100644
--- a/apps/gui/wps_debug.c
+++ b/apps/gui/wps_debug.c
@@ -242,6 +242,10 @@ static void dump_wps_tokens(struct wps_data *data)
snprintf(buf, sizeof(buf), "time elapsed in track");
break;
+ case WPS_TOKEN_TRACK_ELAPSED_PERCENT:
+ snprintf(buf, sizeof(buf), "played percentage of track");
+ break;
+
case WPS_TOKEN_PLAYLIST_ENTRIES:
snprintf(buf, sizeof(buf), "number of entries in playlist");
break;
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index 43ea516b53..86b74129f2 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -247,6 +247,7 @@ static const struct wps_tag all_tags[] = {
{ 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_REMAINING, "pr", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_TRACK_LENGTH, "pt", WPS_REFRESH_STATIC, NULL },