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 "applimits.h"
|
||||||
#include "dbtree.h"
|
#include "dbtree.h"
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
|
#include "lang.h"
|
||||||
|
|
||||||
#ifdef LITTLE_ENDIAN
|
#ifdef LITTLE_ENDIAN
|
||||||
#include <netinet/in.h>
|
#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);
|
DEBUGF("db_load(%d, %x, %d)\n", table, extra, c->firstpos);
|
||||||
|
|
||||||
if (!table) {
|
if (!table) {
|
||||||
table = allartists;
|
table = root;
|
||||||
c->currtable = table;
|
c->currtable = table;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (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:
|
case allsongs:
|
||||||
offset = songstart + c->firstpos * (songlen + 12);
|
offset = songstart + c->firstpos * (songlen + 12);
|
||||||
itemcount = songcount;
|
itemcount = songcount;
|
||||||
|
@ -303,34 +322,36 @@ int db_load(struct tree_context* c)
|
||||||
|
|
||||||
void db_enter(struct tree_context* c)
|
void db_enter(struct tree_context* c)
|
||||||
{
|
{
|
||||||
switch (c->currtable) {
|
int newextra = ((int*)c->dircache)[(c->dircursor + c->dirstart)*2 + 1];
|
||||||
case allartists:
|
|
||||||
case albums4artist:
|
|
||||||
c->dirpos[c->dirlevel] = c->dirstart;
|
c->dirpos[c->dirlevel] = c->dirstart;
|
||||||
c->cursorpos[c->dirlevel] = c->dircursor;
|
c->cursorpos[c->dirlevel] = c->dircursor;
|
||||||
c->table_history[c->dirlevel] = c->currtable;
|
c->table_history[c->dirlevel] = c->currtable;
|
||||||
c->extra_history[c->dirlevel] = c->currextra;
|
c->extra_history[c->dirlevel] = c->currextra;
|
||||||
c->pos_history[c->dirlevel] = c->firstpos;
|
c->pos_history[c->dirlevel] = c->firstpos;
|
||||||
c->dirlevel++;
|
c->dirlevel++;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (c->currtable) {
|
switch (c->currtable) {
|
||||||
case allartists:
|
case root:
|
||||||
c->currtable = albums4artist;
|
c->currtable = newextra;
|
||||||
c->currextra = ((int*)c->dircache)[(c->dircursor + c->dirstart)*2 + 1];
|
c->currextra = newextra;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case allartists:
|
||||||
|
c->currtable = albums4artist;
|
||||||
|
c->currextra = newextra;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case allalbums:
|
||||||
case albums4artist:
|
case albums4artist:
|
||||||
c->currtable = songs4album;
|
c->currtable = songs4album;
|
||||||
c->currextra = ((int*)c->dircache)[(c->dircursor + c->dirstart)*2 + 1];
|
c->currextra = newextra;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case songs4album:
|
case songs4album:
|
||||||
|
case allsongs:
|
||||||
splash(HZ,true,"No playing implemented yet");
|
splash(HZ,true,"No playing implemented yet");
|
||||||
|
c->dirlevel--;
|
||||||
#if 0
|
#if 0
|
||||||
/* find filenames, build playlist, play */
|
/* find filenames, build playlist, play */
|
||||||
playlist_create(NULL,NULL);
|
playlist_create(NULL,NULL);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
|
|
||||||
enum table { invalid, allsongs, allalbums, allartists,
|
enum table { invalid, root, allsongs, allalbums, allartists,
|
||||||
albums4artist, songs4album };
|
albums4artist, songs4album };
|
||||||
|
|
||||||
int db_init(void);
|
int db_init(void);
|
||||||
|
|
|
@ -2877,3 +2877,21 @@ desc: show ID3 database
|
||||||
eng: "ID3 database"
|
eng: "ID3 database"
|
||||||
voice: "ID3 database"
|
voice: "ID3 database"
|
||||||
new:
|
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:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue