forked from len0rd/rockbox
Added a virtual 'Artists,Albums,Songs' root folder in ID3 browser
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5606 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f44a519119
commit
cb7a3d27e2
4 changed files with 58 additions and 19 deletions
|
@ -39,6 +39,7 @@
|
|||
#include "applimits.h"
|
||||
#include "dbtree.h"
|
||||
#include "icons.h"
|
||||
#include "lang.h"
|
||||
|
||||
#ifdef LITTLE_ENDIAN
|
||||
#include <netinet/in.h>
|
||||
|
@ -148,11 +149,29 @@ int db_load(struct tree_context* c)
|
|||
DEBUGF("db_load(%d, %x, %d)\n", table, extra, c->firstpos);
|
||||
|
||||
if (!table) {
|
||||
table = allartists;
|
||||
table = root;
|
||||
c->currtable = table;
|
||||
}
|
||||
|
||||
switch (table) {
|
||||
case root: {
|
||||
static const int tables[] = {allartists, allalbums, allsongs};
|
||||
char* nbuf = (char*)nptr;
|
||||
char* labels[3] = { str(LANG_ID3DB_ARTISTS),
|
||||
str(LANG_ID3DB_ALBUMS),
|
||||
str(LANG_ID3DB_SONGS)};
|
||||
|
||||
for (i=0; i < 3; i++) {
|
||||
strcpy(nbuf, labels[i]);
|
||||
dptr[0] = (unsigned int)nbuf;
|
||||
dptr[1] = tables[i];
|
||||
nbuf += strlen(nbuf) + 1;
|
||||
dptr += 2;
|
||||
}
|
||||
c->dirlength = c->filesindir = i;
|
||||
return i;
|
||||
}
|
||||
|
||||
case allsongs:
|
||||
offset = songstart + c->firstpos * (songlen + 12);
|
||||
itemcount = songcount;
|
||||
|
@ -303,34 +322,36 @@ int db_load(struct tree_context* c)
|
|||
|
||||
void db_enter(struct tree_context* c)
|
||||
{
|
||||
switch (c->currtable) {
|
||||
case allartists:
|
||||
case albums4artist:
|
||||
c->dirpos[c->dirlevel] = c->dirstart;
|
||||
c->cursorpos[c->dirlevel] = c->dircursor;
|
||||
c->table_history[c->dirlevel] = c->currtable;
|
||||
c->extra_history[c->dirlevel] = c->currextra;
|
||||
c->pos_history[c->dirlevel] = c->firstpos;
|
||||
c->dirlevel++;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
int newextra = ((int*)c->dircache)[(c->dircursor + c->dirstart)*2 + 1];
|
||||
|
||||
c->dirpos[c->dirlevel] = c->dirstart;
|
||||
c->cursorpos[c->dirlevel] = c->dircursor;
|
||||
c->table_history[c->dirlevel] = c->currtable;
|
||||
c->extra_history[c->dirlevel] = c->currextra;
|
||||
c->pos_history[c->dirlevel] = c->firstpos;
|
||||
c->dirlevel++;
|
||||
|
||||
switch (c->currtable) {
|
||||
case root:
|
||||
c->currtable = newextra;
|
||||
c->currextra = newextra;
|
||||
break;
|
||||
|
||||
case allartists:
|
||||
c->currtable = albums4artist;
|
||||
c->currextra = ((int*)c->dircache)[(c->dircursor + c->dirstart)*2 + 1];
|
||||
c->currextra = newextra;
|
||||
break;
|
||||
|
||||
case allalbums:
|
||||
case albums4artist:
|
||||
c->currtable = songs4album;
|
||||
c->currextra = ((int*)c->dircache)[(c->dircursor + c->dirstart)*2 + 1];
|
||||
c->currextra = newextra;
|
||||
break;
|
||||
|
||||
case songs4album:
|
||||
case allsongs:
|
||||
splash(HZ,true,"No playing implemented yet");
|
||||
c->dirlevel--;
|
||||
#if 0
|
||||
/* find filenames, build playlist, play */
|
||||
playlist_create(NULL,NULL);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "tree.h"
|
||||
|
||||
enum table { invalid, allsongs, allalbums, allartists,
|
||||
enum table { invalid, root, allsongs, allalbums, allartists,
|
||||
albums4artist, songs4album };
|
||||
|
||||
int db_init(void);
|
||||
|
|
|
@ -2877,3 +2877,21 @@ desc: show ID3 database
|
|||
eng: "ID3 database"
|
||||
voice: "ID3 database"
|
||||
new:
|
||||
|
||||
id: LANG_ID3DB_ARTISTS
|
||||
desc: ID3 virtual folder name
|
||||
eng: "Artists"
|
||||
voice: "Artists"
|
||||
new:
|
||||
|
||||
id: LANG_ID3DB_ALBUMS
|
||||
desc: ID3 virtual folder name
|
||||
eng: "Albums"
|
||||
voice: "Albums"
|
||||
new:
|
||||
|
||||
id: LANG_ID3DB_SONGS
|
||||
desc: ID3 virtual folder name
|
||||
eng: "Songs"
|
||||
voice: "Songs"
|
||||
new:
|
||||
|
|
|
@ -1389,7 +1389,7 @@ void tree_init(void)
|
|||
/* We copy the settings value in case it is changed by the user. We can't
|
||||
use it until the next reboot. */
|
||||
max_files = global_settings.max_files_in_dir;
|
||||
|
||||
|
||||
/* initialize tree context struct */
|
||||
memset(&tc, 0, sizeof(tc));
|
||||
tc.dirfilter = &global_settings.dirfilter;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue