Rockbox mail archive
Subject: m3u-only patch
From: Mats Lidell (matsl_at_contactor.se)
Date: 2002-08-08
Hi,
This is a patch that adds an m3u-only filter. Only m3u-files in the
current directory are displayed.
Maybe a little veird thing since you can navigate outside the
directory where you are when you enter the m3u-only-mode but if you
have all m3u's in one place, preferably the root, it is very easy to
get to them.
Discussion: If you want to use the archos as an mp3-player, mostly
playing albums and don't have more m3u-files than you can manage in
one directory this might be for you. With a 60GB disk filled with
playlists this might be a bad idea ;-)
Warning: I haven't been able to test the rtc-code. So it is just
patched as I think it should be. Take care.
----------------------------------------------------------------------
Index: settings.c
===================================================================
RCS file: /cvsroot/rockbox/apps/settings.c,v
retrieving revision 1.18
diff -u -u -r1.18 settings.c
--- settings.c 7 Aug 2002 12:44:41 -0000 1.18
+++ settings.c 8 Aug 2002 12:29:24 -0000
@@ -119,7 +119,8 @@
/*
* save the config block buffer on the RTC RAM
*/
-static int save_config_buffer( void )
+static int
+ save_config_buffer( void )
{
unsigned char addr = 0x14;
int r;
@@ -265,10 +266,10 @@
rtc_config_block[0xe] = (unsigned char)
((global_settings.playlist_shuffle & 1) |
- ((global_settings.mp3filter & 1) << 1) |
- ((global_settings.sort_case & 1) << 2) |
- ((global_settings.discharge & 1) << 3) |
- ((global_settings.statusbar & 1) << 4));
+ ((global_settings.mp3filter & 3) << 1) |
+ ((global_settings.sort_case & 1) << 3) |
+ ((global_settings.discharge & 1) << 4) |
+ ((global_settings.statusbar & 1) << 5));
rtc_config_block[0xf] = (unsigned char)
((global_settings.scroll_speed << 3) |
@@ -333,10 +334,10 @@
global_settings.resume = rtc_config_block[0xd];
if (rtc_config_block[0xe] != 0xFF) {
global_settings.playlist_shuffle = rtc_config_block[0xe] & 1;
- global_settings.mp3filter = (rtc_config_block[0xe] >> 1) & 1;
- global_settings.sort_case = (rtc_config_block[0xe] >> 2) & 1;
- global_settings.discharge = (rtc_config_block[0xe] >> 3) & 1;
- global_settings.statusbar = (rtc_config_block[0xe] >> 4) & 1;
+ global_settings.mp3filter = (rtc_config_block[0xe] >> 1) & 3;
+ global_settings.sort_case = (rtc_config_block[0xe] >> 3) & 1;
+ global_settings.discharge = (rtc_config_block[0xe] >> 4) & 1;
+ global_settings.statusbar = (rtc_config_block[0xe] >> 5) & 1;
}
c = rtc_config_block[0xf] >> 3;
@@ -378,7 +379,7 @@
global_settings.poweroff = DEFAULT_POWEROFF_SETTING;
global_settings.backlight = DEFAULT_BACKLIGHT_SETTING;
global_settings.wps_display = DEFAULT_WPS_DISPLAY;
- global_settings.mp3filter = true;
+ global_settings.mp3filter = DEFAULT_MP3_FILTER;
global_settings.sort_case = false;
global_settings.statusbar = true;
global_settings.loop_playlist = true;
Index: settings.h
===================================================================
RCS file: /cvsroot/rockbox/apps/settings.h,v
retrieving revision 1.11
diff -u -u -r1.11 settings.h
--- settings.h 7 Aug 2002 10:34:54 -0000 1.11
+++ settings.h 8 Aug 2002 12:29:24 -0000
@@ -28,6 +28,10 @@
#define RESUME_SONG 1 /* resume song at startup */
#define RESUME_PLAYLIST 2 /* resume playlist at startup */
+#define MP3_FILTER_OFF 0
+#define MP3_FILTER_M3U 1
+#define MP3_FILTER_ON 2
+
struct user_settings
{
/* audio settings */
@@ -55,7 +59,7 @@
/* misc options */
int loop_playlist; /* do we return to top of playlist at end? */
- bool mp3filter; /* only display mp3/m3u files and dirs in directory? */
+ int mp3filter; /* only display mp3/m3u files and dirs in directory? */
bool sort_case; /* dir sort order: 0=case insensitive, 1=sensitive */
int scroll_speed; /* long texts scrolling speed: 1-20 */
bool playlist_shuffle;
@@ -102,6 +106,7 @@
#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 MP3_FILTER_M3U
#endif /* __SETTINGS_H__ */
Index: settings_menu.c
===================================================================
RCS file: /cvsroot/rockbox/apps/settings_menu.c,v
retrieving revision 1.11
diff -u -u -r1.11 settings_menu.c
--- settings_menu.c 7 Aug 2002 10:34:54 -0000 1.11
+++ settings_menu.c 8 Aug 2002 12:29:24 -0000
@@ -41,7 +41,8 @@
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 sort_case(void)
Index: tree.c
===================================================================
RCS file: /cvsroot/rockbox/apps/tree.c,v
retrieving revision 1.81
diff -u -u -r1.81 tree.c
--- tree.c 8 Aug 2002 12:06:38 -0000 1.81
+++ tree.c 8 Aug 2002 12:29:24 -0000
@@ -187,6 +187,7 @@
dptr->attr |= TREE_ATTR_M3U;
}
+
/* filter hidden files and directories and non-mp3 or m3u files */
if ( global_settings.mp3filter &&
((dptr->attr & ATTR_HIDDEN) ||
@@ -195,6 +196,13 @@
continue;
}
+ /* Filter even more. Only show m3u-files in the current directory */
+ if (1 == global_settings.mp3filter &&
+ !(dptr->attr & TREE_ATTR_M3U)) {
+ i--;
+ continue;
+ }
+
strncpy(dptr->name,entry->d_name,TREE_MAX_FILENAMELEN);
dptr->name[TREE_MAX_FILENAMELEN-1]=0;
dircacheptr[i] = dptr;
@@ -433,7 +441,7 @@
break;
case TREE_MENU: {
- bool lastfilter = global_settings.mp3filter;
+ int lastfilter = global_settings.mp3filter;
bool lastsortcase = global_settings.sort_case;
#ifdef HAVE_LCD_BITMAP
bool laststate=statusbar(false);
----------------------------------------------------------------------
Yours
--
%% Mats
Page was last modified "Jan 10 2012" The Rockbox Crew
|