Added mp3/m3u filter
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1230 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b6d3bc2dd9
commit
24fdde0894
2 changed files with 25 additions and 5 deletions
|
@ -75,6 +75,8 @@ void reset_settings( struct user_settings *settings ) {
|
||||||
settings->poweroff = DEFAULT_POWEROFF_SETTING;
|
settings->poweroff = DEFAULT_POWEROFF_SETTING;
|
||||||
settings->backlight = DEFAULT_BACKLIGHT_SETTING;
|
settings->backlight = DEFAULT_BACKLIGHT_SETTING;
|
||||||
settings->wps_display = DEFAULT_WPS_DISPLAY;
|
settings->wps_display = DEFAULT_WPS_DISPLAY;
|
||||||
|
settings->mp3filter = true;
|
||||||
|
settings->playlist_shuffle = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
24
apps/tree.c
24
apps/tree.c
|
@ -34,6 +34,7 @@
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "wps.h"
|
#include "wps.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
|
@ -51,6 +52,7 @@ struct entry {
|
||||||
static struct entry dircache[MAX_FILES_IN_DIR];
|
static struct entry dircache[MAX_FILES_IN_DIR];
|
||||||
static struct entry* dircacheptr[MAX_FILES_IN_DIR];
|
static struct entry* dircacheptr[MAX_FILES_IN_DIR];
|
||||||
static int filesindir;
|
static int filesindir;
|
||||||
|
static char lastdir[256] = {0};
|
||||||
|
|
||||||
void browse_root(void)
|
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 int showdir(char *path, int start)
|
||||||
{
|
{
|
||||||
static char lastdir[256] = {0};
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
int icon_type = 0;
|
int icon_type = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -123,6 +123,7 @@ static int showdir(char *path, int start)
|
||||||
return -1; /* not a directory */
|
return -1; /* not a directory */
|
||||||
memset(dircacheptr,0,sizeof(dircacheptr));
|
memset(dircacheptr,0,sizeof(dircacheptr));
|
||||||
for ( i=0; i<MAX_FILES_IN_DIR; i++ ) {
|
for ( i=0; i<MAX_FILES_IN_DIR; i++ ) {
|
||||||
|
int len;
|
||||||
struct dirent *entry = readdir(dir);
|
struct dirent *entry = readdir(dir);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
break;
|
break;
|
||||||
|
@ -132,6 +133,18 @@ static int showdir(char *path, int start)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
dircache[i].file = !(entry->attribute & ATTR_DIRECTORY);
|
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);
|
strncpy(dircache[i].name,entry->d_name,TREE_MAX_FILENAMELEN);
|
||||||
dircache[i].name[TREE_MAX_FILENAMELEN-1]=0;
|
dircache[i].name[TREE_MAX_FILENAMELEN-1]=0;
|
||||||
dircacheptr[i] = &dircache[i];
|
dircacheptr[i] = &dircache[i];
|
||||||
|
@ -362,11 +375,16 @@ bool dirbrowse(char *root)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TREE_MENU:
|
case TREE_MENU: {
|
||||||
|
bool lastfilter = global_settings.mp3filter;
|
||||||
lcd_stop_scroll();
|
lcd_stop_scroll();
|
||||||
main_menu();
|
main_menu();
|
||||||
|
/* do we need to rescan dir? */
|
||||||
|
if ( lastfilter != global_settings.mp3filter )
|
||||||
|
lastdir[0] = 0;
|
||||||
restore = true;
|
restore = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case BUTTON_ON:
|
case BUTTON_ON:
|
||||||
if ( play_mode ) {
|
if ( play_mode ) {
|
||||||
|
|
Loading…
Reference in a new issue