summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-06-27 09:12:29 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-06-27 09:12:29 +0000
commit24fdde08940afc5144b0c625bedbc520ead15d5a (patch)
treec01717ce095095c9e6da7f11c5a85ae787abfd2f /apps
parentb6d3bc2dd96705985675f8ad372a494470c6d932 (diff)
downloadrockbox-24fdde08940afc5144b0c625bedbc520ead15d5a.zip
rockbox-24fdde08940afc5144b0c625bedbc520ead15d5a.tar.gz
rockbox-24fdde08940afc5144b0c625bedbc520ead15d5a.tar.bz2
rockbox-24fdde08940afc5144b0c625bedbc520ead15d5a.tar.xz
Added mp3/m3u filter
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1230 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/settings.c2
-rw-r--r--apps/tree.c28
2 files changed, 25 insertions, 5 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 61aaf40..ba29b89 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -75,6 +75,8 @@ void reset_settings( struct user_settings *settings ) {
settings->poweroff = DEFAULT_POWEROFF_SETTING;
settings->backlight = DEFAULT_BACKLIGHT_SETTING;
settings->wps_display = DEFAULT_WPS_DISPLAY;
+ settings->mp3filter = true;
+ settings->playlist_shuffle = false;
}
diff --git a/apps/tree.c b/apps/tree.c
index 253a8f1..0ba622f 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -34,6 +34,7 @@
#include "playlist.h"
#include "menu.h"
#include "wps.h"
+#include "settings.h"
#ifdef HAVE_LCD_BITMAP
#include "icons.h"
@@ -44,13 +45,14 @@
#define MAX_DIR_LEVELS 10
struct entry {
- bool file; /* true if file, false if dir */
- char name[TREE_MAX_FILENAMELEN];
+ bool file; /* true if file, false if dir */
+ char name[TREE_MAX_FILENAMELEN];
};
static struct entry dircache[MAX_FILES_IN_DIR];
static struct entry* dircacheptr[MAX_FILES_IN_DIR];
static int filesindir;
+static char lastdir[256] = {0};
void browse_root(void)
{
@@ -109,8 +111,6 @@ static int compare(const void* e1, const void* e2)
static int showdir(char *path, int start)
{
- static char lastdir[256] = {0};
-
#ifdef HAVE_LCD_BITMAP
int icon_type = 0;
#endif
@@ -123,6 +123,7 @@ static int showdir(char *path, int start)
return -1; /* not a directory */
memset(dircacheptr,0,sizeof(dircacheptr));
for ( i=0; i<MAX_FILES_IN_DIR; i++ ) {
+ int len;
struct dirent *entry = readdir(dir);
if (!entry)
break;
@@ -132,6 +133,18 @@ static int showdir(char *path, int start)
continue;
}
dircache[i].file = !(entry->attribute & ATTR_DIRECTORY);
+
+ /* 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;
+ }
+
strncpy(dircache[i].name,entry->d_name,TREE_MAX_FILENAMELEN);
dircache[i].name[TREE_MAX_FILENAMELEN-1]=0;
dircacheptr[i] = &dircache[i];
@@ -362,11 +375,16 @@ bool dirbrowse(char *root)
}
break;
- case TREE_MENU:
+ case TREE_MENU: {
+ bool lastfilter = global_settings.mp3filter;
lcd_stop_scroll();
main_menu();
+ /* do we need to rescan dir? */
+ if ( lastfilter != global_settings.mp3filter )
+ lastdir[0] = 0;
restore = true;
break;
+ }
case BUTTON_ON:
if ( play_mode ) {