forked from len0rd/rockbox
Added ID3 database support for individual tracks in the context menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7421 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d565269cfa
commit
196376c3c2
4 changed files with 34 additions and 10 deletions
|
@ -478,6 +478,22 @@ void db_exit(struct tree_context* c)
|
||||||
c->firstpos = c->pos_history[c->dirlevel];
|
c->firstpos = c->pos_history[c->dirlevel];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int db_get_filename(struct tree_context* c, char *buf, int buflen)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
int filenum = c->dircursor + c->dirstart;
|
||||||
|
int pathoffset = ((int*)c->dircache)[filenum * c->dentry_size + 1];
|
||||||
|
|
||||||
|
lseek(tagdb_fd, pathoffset, SEEK_SET);
|
||||||
|
rc = read(tagdb_fd, buf, buflen);
|
||||||
|
|
||||||
|
if (rc < tagdbheader.songlen) {
|
||||||
|
DEBUGF("short path read(%ld) = %d\n", sizeof(buf), rc);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int db_play_folder(struct tree_context* c)
|
static int db_play_folder(struct tree_context* c)
|
||||||
{
|
{
|
||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
|
|
|
@ -34,8 +34,7 @@ const char* db_get_icon(struct tree_context* c);
|
||||||
#else
|
#else
|
||||||
int db_get_icon(struct tree_context* c);
|
int db_get_icon(struct tree_context* c);
|
||||||
#endif
|
#endif
|
||||||
|
int db_get_filename(struct tree_context* c, char *buf, int buflen);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -278,7 +278,7 @@ static bool playlist_options(void)
|
||||||
pstart++;
|
pstart++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context == CONTEXT_TREE)
|
if (context == CONTEXT_TREE || context == CONTEXT_ID3DB)
|
||||||
{
|
{
|
||||||
if (audio_status() & AUDIO_STATUS_PLAY)
|
if (audio_status() & AUDIO_STATUS_PLAY)
|
||||||
{
|
{
|
||||||
|
@ -536,7 +536,8 @@ int onplay(char* file, int attr, int from)
|
||||||
|
|
||||||
if (context == CONTEXT_WPS ||
|
if (context == CONTEXT_WPS ||
|
||||||
context == CONTEXT_TREE ||
|
context == CONTEXT_TREE ||
|
||||||
context == CONTEXT_ID3DB)
|
((context == CONTEXT_ID3DB) &&
|
||||||
|
(attr & TREE_ATTR_MASK) == TREE_ATTR_MPA))
|
||||||
{
|
{
|
||||||
items[i].desc = ID2P(LANG_PLAYLIST);
|
items[i].desc = ID2P(LANG_PLAYLIST);
|
||||||
items[i].function = playlist_options;
|
items[i].function = playlist_options;
|
||||||
|
|
20
apps/tree.c
20
apps/tree.c
|
@ -1041,13 +1041,8 @@ static bool dirbrowse(void)
|
||||||
if(!numentries)
|
if(!numentries)
|
||||||
onplay_result = onplay(NULL, 0, curr_context);
|
onplay_result = onplay(NULL, 0, curr_context);
|
||||||
else {
|
else {
|
||||||
if (currdir[1])
|
|
||||||
snprintf(buf, sizeof buf, "%s/%s",
|
|
||||||
currdir, dircache[tc.dircursor+tc.dirstart].name);
|
|
||||||
else
|
|
||||||
snprintf(buf, sizeof buf, "/%s",
|
|
||||||
dircache[tc.dircursor+tc.dirstart].name);
|
|
||||||
if (id3db)
|
if (id3db)
|
||||||
|
{
|
||||||
switch (tc.currtable)
|
switch (tc.currtable)
|
||||||
{
|
{
|
||||||
case allsongs:
|
case allsongs:
|
||||||
|
@ -1055,10 +1050,23 @@ static bool dirbrowse(void)
|
||||||
case songs4artist:
|
case songs4artist:
|
||||||
case searchsongs:
|
case searchsongs:
|
||||||
attr=TREE_ATTR_MPA;
|
attr=TREE_ATTR_MPA;
|
||||||
|
db_get_filename(&tc, buf, sizeof(buf));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
attr = dircache[tc.dircursor+tc.dirstart].attr;
|
attr = dircache[tc.dircursor+tc.dirstart].attr;
|
||||||
|
|
||||||
|
if (currdir[1])
|
||||||
|
snprintf(buf, sizeof buf, "%s/%s",
|
||||||
|
currdir,
|
||||||
|
dircache[tc.dircursor+tc.dirstart].name);
|
||||||
|
else
|
||||||
|
snprintf(buf, sizeof buf, "/%s",
|
||||||
|
dircache[tc.dircursor+tc.dirstart].name);
|
||||||
|
}
|
||||||
|
|
||||||
onplay_result = onplay(buf, attr, curr_context);
|
onplay_result = onplay(buf, attr, curr_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue