1
0
Fork 0
forked from len0rd/rockbox

2 new tags:

%pS - track is starting.
%pE - track is ending. both can optionally have a number straight after to change how long that tag should stay true for (e.g %pS10 will stay true for the first 10s of the track)


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25239 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2010-03-18 07:08:49 +00:00
parent c3c928b29f
commit d2e2c2ad96
3 changed files with 23 additions and 0 deletions

View file

@ -328,6 +328,8 @@ static const struct wps_tag all_tags[] = {
{ 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 },
{ WPS_TOKEN_TRACK_STARTING, "pS", WPS_REFRESH_DYNAMIC, parse_timeout },
{ WPS_TOKEN_TRACK_ENDING, "pE", WPS_REFRESH_DYNAMIC, parse_timeout },
{ WPS_TOKEN_PLAYLIST_POSITION, "pp", WPS_REFRESH_STATIC, NULL },
{ WPS_TOKEN_PLAYLIST_ENTRIES, "pe", WPS_REFRESH_STATIC, NULL },
@ -1106,6 +1108,8 @@ static int parse_timeout(const char *wps_bufptr,
case WPS_TOKEN_SUBLINE_TIMEOUT:
return -1;
case WPS_TOKEN_BUTTON_VOLUME:
case WPS_TOKEN_TRACK_STARTING:
case WPS_TOKEN_TRACK_ENDING:
val = 10;
break;
}

View file

@ -896,6 +896,23 @@ const char *get_token_value(struct gui_wps *gwps,
token->value.i * TIMEOUT_UNIT))
return "v";
return NULL;
case WPS_TOKEN_TRACK_STARTING:
if (id3)
{
int elapsed = id3->elapsed + + state->ff_rewind_count;
if (elapsed < token->value.i * HZ)
return "starting";
}
return NULL;
case WPS_TOKEN_TRACK_ENDING:
if (id3)
{
int elapsed = id3->elapsed + + state->ff_rewind_count;
if (id3->length - elapsed < token->value.i * HZ)
return "ending";
}
return NULL;
case WPS_TOKEN_LASTTOUCH:
#ifdef HAVE_TOUCHSCREEN
if (TIME_BEFORE(current_tick, token->value.i * TIMEOUT_UNIT +

View file

@ -178,6 +178,8 @@ enum wps_token_type {
WPS_TOKEN_TRACK_TIME_ELAPSED,
WPS_TOKEN_TRACK_TIME_REMAINING,
WPS_TOKEN_TRACK_LENGTH,
WPS_TOKEN_TRACK_STARTING,
WPS_TOKEN_TRACK_ENDING,
/* Playlist */
TOKEN_MARKER_PLAYLIST,