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 engine: Streamline handling of the %mp tag a little

current_playmode() returns a value from 'enum playmode' and we
can take advantage of the enum values to simplify the code.

Change-Id: I368ec38ba5061f6cc6d3382e536db2312b27d643

+11 -28
+11 -28
apps/gui/skin_engine/skin_tokens.c
··· 1039 1039 case SKIN_TOKEN_PLAYBACK_STATUS: 1040 1040 { 1041 1041 int status = current_playmode(); 1042 - /* music */ 1043 - int mode = 1; /* stop */ 1044 - if (status == STATUS_PLAY) 1045 - mode = 2; /* play */ 1046 - if (status == STATUS_PAUSE && !status_get_ffmode()) 1047 - mode = 3; /* pause */ 1048 - else 1049 - { /* ff / rwd */ 1050 - if (status_get_ffmode() == STATUS_FASTFORWARD) 1051 - mode = 4; 1052 - if (status_get_ffmode() == STATUS_FASTBACKWARD) 1053 - mode = 5; 1042 + switch (status) { 1043 + case STATUS_STOP: 1044 + numeric_ret = 1; 1045 + break; 1046 + case STATUS_PLAY: 1047 + numeric_ret = 2; 1048 + break; 1049 + default: 1050 + numeric_ret = status + 1; 1051 + break; 1054 1052 } 1055 - #ifdef HAVE_RECORDING 1056 - /* recording */ 1057 - if (status == STATUS_RECORD) 1058 - mode = 6; 1059 - else if (status == STATUS_RECORD_PAUSE) 1060 - mode = 7; 1061 - #endif 1062 - #if CONFIG_TUNER 1063 - /* radio */ 1064 - if (status == STATUS_RADIO) 1065 - mode = 8; 1066 - else if (status == STATUS_RADIO_PAUSE) 1067 - mode = 9; 1068 - #endif 1069 1053 1070 - numeric_ret = mode; 1071 - snprintf(buf, buf_size, "%d", mode-1); 1054 + snprintf(buf, buf_size, "%d", numeric_ret-1); 1072 1055 numeric_buf = buf; 1073 1056 goto gtv_ret_numeric_tag_info; 1074 1057 }