diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2005-08-30 07:52:36 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2005-08-30 07:52:36 +0000 |
commit | 196376c3c2b74a1f0f6f3040f833491d1b45e5f6 (patch) | |
tree | 928f9c50cf2413dfbd102c18d57585a1ee811466 | |
parent | d565269cfa71b23deae19c17494354855ab096d9 (diff) | |
download | rockbox-196376c3c2b74a1f0f6f3040f833491d1b45e5f6.tar.gz rockbox-196376c3c2b74a1f0f6f3040f833491d1b45e5f6.zip |
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
-rw-r--r-- | apps/dbtree.c | 16 | ||||
-rw-r--r-- | apps/dbtree.h | 3 | ||||
-rw-r--r-- | apps/onplay.c | 5 | ||||
-rw-r--r-- | apps/tree.c | 20 |
4 files changed, 34 insertions, 10 deletions
diff --git a/apps/dbtree.c b/apps/dbtree.c index 1121ea4070..e3704ac381 100644 --- a/apps/dbtree.c +++ b/apps/dbtree.c | |||
@@ -478,6 +478,22 @@ void db_exit(struct tree_context* c) | |||
478 | c->firstpos = c->pos_history[c->dirlevel]; | 478 | c->firstpos = c->pos_history[c->dirlevel]; |
479 | } | 479 | } |
480 | 480 | ||
481 | int db_get_filename(struct tree_context* c, char *buf, int buflen) | ||
482 | { | ||
483 | int rc; | ||
484 | int filenum = c->dircursor + c->dirstart; | ||
485 | int pathoffset = ((int*)c->dircache)[filenum * c->dentry_size + 1]; | ||
486 | |||
487 | lseek(tagdb_fd, pathoffset, SEEK_SET); | ||
488 | rc = read(tagdb_fd, buf, buflen); | ||
489 | |||
490 | if (rc < tagdbheader.songlen) { | ||
491 | DEBUGF("short path read(%ld) = %d\n", sizeof(buf), rc); | ||
492 | return -2; | ||
493 | } | ||
494 | return 0; | ||
495 | } | ||
496 | |||
481 | static int db_play_folder(struct tree_context* c) | 497 | static int db_play_folder(struct tree_context* c) |
482 | { | 498 | { |
483 | char buf[MAX_PATH]; | 499 | char buf[MAX_PATH]; |
diff --git a/apps/dbtree.h b/apps/dbtree.h index 1e26f5d521..50d34b2a82 100644 --- a/apps/dbtree.h +++ b/apps/dbtree.h | |||
@@ -34,8 +34,7 @@ const char* db_get_icon(struct tree_context* c); | |||
34 | #else | 34 | #else |
35 | int db_get_icon(struct tree_context* c); | 35 | int db_get_icon(struct tree_context* c); |
36 | #endif | 36 | #endif |
37 | 37 | int db_get_filename(struct tree_context* c, char *buf, int buflen); | |
38 | |||
39 | 38 | ||
40 | #endif | 39 | #endif |
41 | 40 | ||
diff --git a/apps/onplay.c b/apps/onplay.c index 89a236bb11..76bc72a048 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -278,7 +278,7 @@ static bool playlist_options(void) | |||
278 | pstart++; | 278 | pstart++; |
279 | } | 279 | } |
280 | 280 | ||
281 | if (context == CONTEXT_TREE) | 281 | if (context == CONTEXT_TREE || context == CONTEXT_ID3DB) |
282 | { | 282 | { |
283 | if (audio_status() & AUDIO_STATUS_PLAY) | 283 | if (audio_status() & AUDIO_STATUS_PLAY) |
284 | { | 284 | { |
@@ -536,7 +536,8 @@ int onplay(char* file, int attr, int from) | |||
536 | 536 | ||
537 | if (context == CONTEXT_WPS || | 537 | if (context == CONTEXT_WPS || |
538 | context == CONTEXT_TREE || | 538 | context == CONTEXT_TREE || |
539 | context == CONTEXT_ID3DB) | 539 | ((context == CONTEXT_ID3DB) && |
540 | (attr & TREE_ATTR_MASK) == TREE_ATTR_MPA)) | ||
540 | { | 541 | { |
541 | items[i].desc = ID2P(LANG_PLAYLIST); | 542 | items[i].desc = ID2P(LANG_PLAYLIST); |
542 | items[i].function = playlist_options; | 543 | items[i].function = playlist_options; |
diff --git a/apps/tree.c b/apps/tree.c index 8746145154..e56c7a76de 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -1041,13 +1041,8 @@ static bool dirbrowse(void) | |||
1041 | if(!numentries) | 1041 | if(!numentries) |
1042 | onplay_result = onplay(NULL, 0, curr_context); | 1042 | onplay_result = onplay(NULL, 0, curr_context); |
1043 | else { | 1043 | else { |
1044 | if (currdir[1]) | ||
1045 | snprintf(buf, sizeof buf, "%s/%s", | ||
1046 | currdir, dircache[tc.dircursor+tc.dirstart].name); | ||
1047 | else | ||
1048 | snprintf(buf, sizeof buf, "/%s", | ||
1049 | dircache[tc.dircursor+tc.dirstart].name); | ||
1050 | if (id3db) | 1044 | if (id3db) |
1045 | { | ||
1051 | switch (tc.currtable) | 1046 | switch (tc.currtable) |
1052 | { | 1047 | { |
1053 | case allsongs: | 1048 | case allsongs: |
@@ -1055,10 +1050,23 @@ static bool dirbrowse(void) | |||
1055 | case songs4artist: | 1050 | case songs4artist: |
1056 | case searchsongs: | 1051 | case searchsongs: |
1057 | attr=TREE_ATTR_MPA; | 1052 | attr=TREE_ATTR_MPA; |
1053 | db_get_filename(&tc, buf, sizeof(buf)); | ||
1058 | break; | 1054 | break; |
1059 | } | 1055 | } |
1056 | } | ||
1060 | else | 1057 | else |
1058 | { | ||
1061 | attr = dircache[tc.dircursor+tc.dirstart].attr; | 1059 | attr = dircache[tc.dircursor+tc.dirstart].attr; |
1060 | |||
1061 | if (currdir[1]) | ||
1062 | snprintf(buf, sizeof buf, "%s/%s", | ||
1063 | currdir, | ||
1064 | dircache[tc.dircursor+tc.dirstart].name); | ||
1065 | else | ||
1066 | snprintf(buf, sizeof buf, "/%s", | ||
1067 | dircache[tc.dircursor+tc.dirstart].name); | ||
1068 | } | ||
1069 | |||
1062 | onplay_result = onplay(buf, attr, curr_context); | 1070 | onplay_result = onplay(buf, attr, curr_context); |
1063 | } | 1071 | } |
1064 | 1072 | ||