Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: m3u-only patch

m3u-only patch

From: Mats Lidell <matsl_at_contactor.se>
Date: Thu, 27 Jun 2002 12:49:08 +0200

Hi

M3u-only mode. Only show m3u-files. Good when you have a lot of
m3u-files in a directory and only want to see those. Confusing when
you don't have any m3u-files at all -> Blank screen!

If accepted into core I guess we should have a few constants for the
different modes, now using raw ints, and the if statement in tree.c
could need an inspection, although I guess it is in the spirit of the
old code ;-)

Disclaimer: Haven't got time for a something fancier. Have to feed the
kids. ;-) CU!

cvs server: Diffing .
Index: settings.c
===================================================================
RCS file: /cvsroot/rockbox/apps/settings.c,v
retrieving revision 1.3
diff -u -u -r1.3 settings.c
--- settings.c 27 Jun 2002 09:12:29 -0000 1.3
+++ settings.c 27 Jun 2002 10:37:12 -0000
_at__at_ -75,7 +75,7 _at__at_
     settings->poweroff = DEFAULT_POWEROFF_SETTING;
     settings->backlight = DEFAULT_BACKLIGHT_SETTING;
     settings->wps_display = DEFAULT_WPS_DISPLAY;
- settings->mp3filter = true;
+ settings->mp3filter = DEFAULT_MP3_FILTER;
     settings->playlist_shuffle = false;
 }
 
Index: settings.h
===================================================================
RCS file: /cvsroot/rockbox/apps/settings.h,v
retrieving revision 1.2
diff -u -u -r1.2 settings.h
--- settings.h 27 Jun 2002 01:08:11 -0000 1.2
+++ settings.h 27 Jun 2002 10:37:12 -0000
_at__at_ -41,7 +41,8 _at__at_
 
     /* device settings */
 
- int contrast; /* lcd contrast: 0-100 0=low 100=high */
+ int contrast; /* lcd contrast: 0-1
+ 00 0=low 100=high */
     int poweroff; /* power off timer: 0-100 0=never:each 1% = 60 secs */
     int backlight; /* backlight off timer: 0-100 0=never:each 1% = 10 secs */
 
_at__at_ -53,7 +54,7 _at__at_
     /* misc options */
 
     int loop_playlist; /* do we return to top of playlist at end? */
- bool mp3filter;
+ int mp3filter;
     int scroll_speed;
     bool playlist_shuffle;
 
_at__at_ -93,6 +94,7 _at__at_
 #define DEFAULT_CONTRAST_SETTING 0
 #define DEFAULT_POWEROFF_SETTING 0
 #define DEFAULT_BACKLIGHT_SETTING 5
-#define DEFAULT_WPS_DISPLAY 0
+#define DEFAULT_WPS_DISPLAY 0
+#define DEFAULT_MP3_FILTER 2
 
 #endif /* __SETTINGS_H__ */
Index: settings_menu.c
===================================================================
RCS file: /cvsroot/rockbox/apps/settings_menu.c,v
retrieving revision 1.5
diff -u -u -r1.5 settings_menu.c
--- settings_menu.c 27 Jun 2002 01:08:11 -0000 1.5
+++ settings_menu.c 27 Jun 2002 10:37:12 -0000
_at__at_ -40,7 +40,8 _at__at_
 
 static void mp3_filter(void)
 {
- set_bool( "[MP3/M3U filter]", &global_settings.mp3filter );
+ char* names[] = { "Off ", "M3u ", "On " };
+ set_option( "[MP3/M3U filter]", &global_settings.mp3filter, names, 3 );
 }
 
 static void backlight_timer(void)
Index: tree.c
===================================================================
RCS file: /cvsroot/rockbox/apps/tree.c,v
retrieving revision 1.51
diff -u -u -r1.51 tree.c
--- tree.c 27 Jun 2002 09:12:29 -0000 1.51
+++ tree.c 27 Jun 2002 10:37:12 -0000
_at__at_ -136,13 +136,25 _at__at_
 
             /* show only dir/m3u/mp3 ? */
             len = strlen(entry->d_name);
- if ( global_settings.mp3filter &&
- dircache[i].file &&
- (len > 4) &&
- (strcasecmp(&entry->d_name[len-4], ".m3u") &&
- strcasecmp(&entry->d_name[len-4], ".mp3"))) {
- i--;
- continue;
+ if ( global_settings.mp3filter ) {
+ if ( dircache[i].file &&
+ (len > 4) &&
+ (strcasecmp(&entry->d_name[len-4], ".m3u") &&
+ strcasecmp(&entry->d_name[len-4], ".mp3"))) {
+ i--;
+ continue;
+ }
+ /* Only m3u. Not even dirs. */
+ if (global_settings.mp3filter == 1) {
+ if ( dircache[i].file &&
+ (len > 4) &&
+ (0 == strcasecmp(&entry->d_name[len-4], ".m3u")))
+ /* Good case. Fall through! */ ;
+ else {
+ i--;
+ continue;
+ }
+ }
             }
 
             strncpy(dircache[i].name,entry->d_name,TREE_MAX_FILENAMELEN);
_at__at_ -376,7 +388,7 _at__at_
                 break;
 
             case TREE_MENU: {
- bool lastfilter = global_settings.mp3filter;
+ int lastfilter = global_settings.mp3filter;
                 lcd_stop_scroll();
                 main_menu();
                 /* do we need to rescan dir? */

Yours
-- 
%% Mats
Received on 2002-06-27

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy