forked from len0rd/rockbox
pressing play on an .m3u file will run the playlist code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@891 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4d1fb48494
commit
c60d12a067
1 changed files with 43 additions and 20 deletions
31
apps/tree.c
31
apps/tree.c
|
@ -172,7 +172,7 @@ static int start=0;
|
||||||
static int dirpos[MAX_DIR_LEVELS];
|
static int dirpos[MAX_DIR_LEVELS];
|
||||||
static int cursorpos[MAX_DIR_LEVELS];
|
static int cursorpos[MAX_DIR_LEVELS];
|
||||||
static int dirlevel=0;
|
static int dirlevel=0;
|
||||||
static bool playing = false;
|
static int playing = 0;
|
||||||
static char currdir[255];
|
static char currdir[255];
|
||||||
|
|
||||||
/* QUICK HACK! this should be handled by the playlist code later */
|
/* QUICK HACK! this should be handled by the playlist code later */
|
||||||
|
@ -180,10 +180,15 @@ char* peek_next_track(int type)
|
||||||
{
|
{
|
||||||
static char buf[256];
|
static char buf[256];
|
||||||
|
|
||||||
/* next-song only works when not browsing */
|
/* next-song only works when playing */
|
||||||
if (!playing)
|
if (!playing)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
switch(playing) {
|
||||||
|
default:
|
||||||
|
case 1:
|
||||||
|
/* play-full-dir mode */
|
||||||
|
|
||||||
/* get next track in dir */
|
/* get next track in dir */
|
||||||
while (dircursor + start + 1 < numentries ) {
|
while (dircursor + start + 1 < numentries ) {
|
||||||
if(dircursor+1 < TREE_MAX_ON_SCREEN)
|
if(dircursor+1 < TREE_MAX_ON_SCREEN)
|
||||||
|
@ -200,6 +205,12 @@ char* peek_next_track(int type)
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
/* playlist mode */
|
||||||
|
return playlist_next(type);
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -286,14 +297,26 @@ bool dirbrowse(char *root)
|
||||||
dircursor=0;
|
dircursor=0;
|
||||||
start=0;
|
start=0;
|
||||||
} else {
|
} else {
|
||||||
playing = true;
|
int len=
|
||||||
|
strlen(dircacheptr[dircursor+start]->name);
|
||||||
|
if((len > 4) &&
|
||||||
|
!strcmp(&dircacheptr[dircursor+start]->name[len-4],
|
||||||
|
".m3u")) {
|
||||||
|
playing = 2;
|
||||||
|
play_list(currdir, dircacheptr[dircursor+start]->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
|
||||||
|
playing = 1;
|
||||||
playtune(currdir, dircacheptr[dircursor+start]->name);
|
playtune(currdir, dircacheptr[dircursor+start]->name);
|
||||||
playing = false;
|
playing = 0;
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
lcd_setmargins(0, MARGIN_Y);
|
lcd_setmargins(0, MARGIN_Y);
|
||||||
lcd_setfont(0);
|
lcd_setfont(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
numentries = showdir(currdir, start);
|
numentries = showdir(currdir, start);
|
||||||
lcd_puts(0, LINE_Y+dircursor, CURSOR_CHAR);
|
lcd_puts(0, LINE_Y+dircursor, CURSOR_CHAR);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue