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.

Fix some bugs with the colors stuff. You can now specify folder color with the folder extension.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13659 a1c6a512-1295-4272-9138-f99709370657

+31 -11
+22 -5
apps/filetypes.c
··· 39 39 #include "splash.h" 40 40 #include "buffer.h" 41 41 #include "icons.h" 42 + #include "logf.h" 42 43 43 44 /* max filetypes (plugins & icons stored here) */ 44 45 #if CONFIG_CODEC == SWCODEC ··· 160 161 { 161 162 if (!settings_parseline(buffer, &ext, &color)) 162 163 continue; 163 - for (i=0; i<filetype_count; i++) 164 + if (!strcasecmp(ext, "folder")) 165 + { 166 + custom_colors[0] = hex_to_rgb(color); 167 + continue; 168 + } 169 + for (i=1; i<filetype_count; i++) 164 170 { 165 171 if (filetypes[i].extension && 166 172 !strcasecmp(ext, filetypes[i].extension)) ··· 369 375 } 370 376 371 377 #ifdef HAVE_LCD_COLOR 372 - int filetype_get_color(int attr) 378 + int filetype_get_color(const char * name, int attr) 373 379 { 374 - int index = find_attr(attr); 375 - if (index < 0) 380 + char *extension; 381 + int i; 382 + if ((attr & ATTR_DIRECTORY)==ATTR_DIRECTORY) 383 + return custom_colors[0]; 384 + extension = strrchr(name, '.'); 385 + if (!extension) 376 386 return -1; 377 - return custom_colors[index]; 387 + extension++; 388 + logf("%s %s",name,extension); 389 + for (i=1; i<filetype_count; i++) 390 + { 391 + if (filetypes[i].extension && 392 + !strcasecmp(extension, filetypes[i].extension)) 393 + return custom_colors[i]; 394 + } 378 395 return -1; 379 396 } 380 397 #endif
+1 -1
apps/filetypes.h
··· 60 60 /* Return the attribute (FILE_ATTR_*) of the file */ 61 61 int filetype_get_attr(const char* file); 62 62 #ifdef HAVE_LCD_COLOR 63 - int filetype_get_color(int attr); 63 + int filetype_get_color(const char * name, int attr); 64 64 #endif 65 65 int filetype_get_icon(int attr); 66 66 /* return the plugin filename associated with the file */
+1 -1
apps/tree.c
··· 171 171 struct tree_context * local_tc=(struct tree_context *)data; 172 172 struct entry* dc = local_tc->dircache; 173 173 struct entry* e = &dc[selected_item]; 174 - return filetype_get_color(e->attr); 174 + return filetype_get_color(e->name, e->attr); 175 175 } 176 176 #endif 177 177
+7 -4
docs/sample.colors
··· 1 - mp3:904010 2 - ogg:D04040 3 - txt:FF0000 4 - cfg:00FF00 1 + folder:808080 2 + ipod:00B0B0 3 + mp3:00FF00 4 + flac:00FF00 5 + ogg:00FF00 6 + txt:FF0000 7 + cfg:D00000