Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

skin: add new %pP tag (playlist progress as percentage)

This new tag returns the position in the playlist as a percent. The main usecase for this is to use it as a bar tag, allowing themes to visually present playlist progress.

Change-Id: I0eb001e7458d97b8a0db39f3980d9c283bc8806b

authored by

Arin Kim and committed by
Solomon Peachy
41d5ca3c 1c429e22

+35 -1
+5
apps/gui/skin_engine/skin_display.c
··· 207 207 length = MAX_PEAK; 208 208 end = peak_meter_scale_value(val, length); 209 209 } 210 + else if (pb->type == SKIN_TOKEN_PLAYLIST_PERCENTBAR) 211 + { 212 + length = playlist_amount(); 213 + end = playlist_get_display_index(); 214 + } 210 215 else if (pb->type == SKIN_TOKEN_LIST_SCROLLBAR) 211 216 { 212 217 int val, min, max;
+3
apps/gui/skin_engine/skin_parser.c
··· 1241 1241 token->type = SKIN_TOKEN_PEAKMETER_LEFTBAR; 1242 1242 else if (token->type == SKIN_TOKEN_PEAKMETER_RIGHT) 1243 1243 token->type = SKIN_TOKEN_PEAKMETER_RIGHTBAR; 1244 + else if (token->type == SKIN_TOKEN_PLAYLIST_PERCENT) 1245 + token->type = SKIN_TOKEN_PLAYLIST_PERCENTBAR; 1244 1246 else if (token->type == SKIN_TOKEN_LIST_NEEDS_SCROLLBAR) 1245 1247 token->type = SKIN_TOKEN_LIST_SCROLLBAR; 1246 1248 else if (token->type == SKIN_TOKEN_SETTING) ··· 2418 2420 case SKIN_TOKEN_PLAYER_PROGRESSBAR: 2419 2421 case SKIN_TOKEN_PEAKMETER_LEFT: 2420 2422 case SKIN_TOKEN_PEAKMETER_RIGHT: 2423 + case SKIN_TOKEN_PLAYLIST_PERCENT: 2421 2424 case SKIN_TOKEN_LIST_NEEDS_SCROLLBAR: 2422 2425 #ifdef HAVE_RADIO_RSSI 2423 2426 case SKIN_TOKEN_TUNER_RSSI:
+1
apps/gui/skin_engine/skin_render.c
··· 225 225 /* fall through to the progressbar code */ 226 226 case SKIN_TOKEN_VOLUMEBAR: 227 227 case SKIN_TOKEN_BATTERY_PERCENTBAR: 228 + case SKIN_TOKEN_PLAYLIST_PERCENTBAR: 228 229 case SKIN_TOKEN_SETTINGBAR: 229 230 case SKIN_TOKEN_PROGRESSBAR: 230 231 case SKIN_TOKEN_TUNER_RSSI_BAR:
+18
apps/gui/skin_engine/skin_tokens.c
··· 1164 1164 numeric_buf = buf; 1165 1165 goto gtv_ret_numeric_tag_info; 1166 1166 1167 + case SKIN_TOKEN_PLAYLIST_PERCENT: 1168 + int playlist_amt = playlist_amount(); 1169 + int current_pos = playlist_get_display_index() + offset; 1170 + int percentage = current_pos * 100 / playlist_amt; 1171 + 1172 + if (intval && limit != TOKEN_VALUE_ONLY) 1173 + { 1174 + numeric_ret = current_pos * limit / playlist_amt; 1175 + } 1176 + else 1177 + { 1178 + numeric_ret = percentage; 1179 + } 1180 + 1181 + itoa_buf(buf, buf_size, percentage); 1182 + numeric_buf = buf; 1183 + goto gtv_ret_numeric_tag_info; 1184 + 1167 1185 case SKIN_TOKEN_PLAYLIST_SHUFFLE: 1168 1186 if ( global_settings.playlist_shuffle ) 1169 1187 return "s";
+1
docs/CREDITS
··· 753 753 Melissa Autumn 754 754 Sho Tanimoto 755 755 Nyx Guan 756 + Arin Kim 756 757 757 758 The libmad team 758 759 The wavpack team
+2
lib/skin_parser/tag_table.c
··· 163 163 TAG(SKIN_TOKEN_TRACK_STARTING, "pS" , "|D", SKIN_REFRESH_DYNAMIC), 164 164 TAG(SKIN_TOKEN_TRACK_ENDING, "pE" , "|D", SKIN_REFRESH_DYNAMIC), 165 165 TAG(SKIN_TOKEN_PLAYLIST_POSITION, "pp", "", SKIN_REFRESH_STATIC), 166 + TAG(SKIN_TOKEN_PLAYLIST_PERCENT, "pP", BAR_PARAMS, SKIN_REFRESH_STATIC), 166 167 TAG(SKIN_TOKEN_PLAYLIST_ENTRIES, "pe", "", SKIN_REFRESH_STATIC), 167 168 TAG(SKIN_TOKEN_PLAYLIST_NAME, "pn", "", SKIN_REFRESH_STATIC), 168 169 TAG(SKIN_TOKEN_PLAYLIST_SHUFFLE, "ps", "", SKIN_REFRESH_DYNAMIC), ··· 329 330 } 330 331 return tag; 331 332 } 333 +
+2
lib/skin_parser/tag_table.h
··· 211 211 SKIN_TOKEN_PLAYLIST_ENTRIES, 212 212 SKIN_TOKEN_PLAYLIST_NAME, 213 213 SKIN_TOKEN_PLAYLIST_POSITION, 214 + SKIN_TOKEN_PLAYLIST_PERCENT, 215 + SKIN_TOKEN_PLAYLIST_PERCENTBAR, 214 216 SKIN_TOKEN_PLAYLIST_SHUFFLE, 215 217 216 218
+3 -1
manual/appendix/wps_tags.tex
··· 174 174 \config{\%pR} & Peak meter for the right channel. Can be used as a value, % 175 175 a conditional tag or a bar tag.\\ 176 176 \config{\%pn} & Playlist name (without path or extension)\\ 177 - \config{\%pp} & Playlist position\\ 177 + \config{\%pp} & Playlist position as index\\ 178 + \config{\%pP} & Playlist position as percentage. Can be used as a value, % 179 + a conditional tag or a bar tag.\\ 178 180 \config{\%pr} & Remaining time in song\\ 179 181 \config{\%ps} & ``s'' if shuffle mode is enabled\\ 180 182 \config{\%pt} & Total track time\\