mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
More usable playlist generation, added "<All tracks>" entry to tag
browser. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9729 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b79c9a6145
commit
991665bcdf
4 changed files with 80 additions and 42 deletions
|
|
@ -1,11 +1,11 @@
|
||||||
"Artists" artist : album : song
|
"Artists" artist : album : title
|
||||||
"Albums" album : song
|
"Albums" album : title
|
||||||
"Genres" genre : artist : album : song
|
"Genres" genre : artist : album : title
|
||||||
"Composers" composer : album : song
|
"Composers" composer : album : title
|
||||||
"Songs" song
|
"Tracks" title
|
||||||
"Search by artist" artist ? artist ~ "" : album : song
|
"Search by artist" artist ? artist ~ "" : album : title
|
||||||
"Search by album" album ? album ~ "" : song
|
"Search by album" album ? album ~ "" : title
|
||||||
"Search by song" song ? song ~ ""
|
"Search by title" title ? title ~ ""
|
||||||
"Search by year" artist ? year = "" : album : song
|
"Search by year" artist ? year = "" : album : title
|
||||||
"Example 1" artist ? year >= "2000" & artist ^ "a" : album : song
|
"Example 1" artist ? year >= "2000" & artist ^ "a" : album : title
|
||||||
"Example 2" genre ? genre ~ "metal" : artist ? year >= "2000" : album ? year >= "2000" : song
|
"Example 2" genre ? genre ~ "metal" : artist ? year >= "2000" : album ? year >= "2000" : title
|
||||||
|
|
|
||||||
|
|
@ -112,15 +112,15 @@ static int get_tag(int *tag)
|
||||||
}
|
}
|
||||||
buf[i] = '\0';
|
buf[i] = '\0';
|
||||||
|
|
||||||
MATCH(tag, buf, "artist", tag_artist);
|
|
||||||
MATCH(tag, buf, "song", tag_title);
|
|
||||||
MATCH(tag, buf, "album", tag_album);
|
MATCH(tag, buf, "album", tag_album);
|
||||||
MATCH(tag, buf, "genre", tag_genre);
|
MATCH(tag, buf, "artist", tag_artist);
|
||||||
MATCH(tag, buf, "composer", tag_composer);
|
|
||||||
MATCH(tag, buf, "year", tag_year);
|
|
||||||
MATCH(tag, buf, "length", tag_length);
|
|
||||||
MATCH(tag, buf, "tracknum", tag_tracknumber);
|
|
||||||
MATCH(tag, buf, "bitrate", tag_bitrate);
|
MATCH(tag, buf, "bitrate", tag_bitrate);
|
||||||
|
MATCH(tag, buf, "composer", tag_composer);
|
||||||
|
MATCH(tag, buf, "genre", tag_genre);
|
||||||
|
MATCH(tag, buf, "length", tag_length);
|
||||||
|
MATCH(tag, buf, "title", tag_title);
|
||||||
|
MATCH(tag, buf, "tracknum", tag_tracknumber);
|
||||||
|
MATCH(tag, buf, "year", tag_year);
|
||||||
|
|
||||||
logf("NO MATCH: %s\n", buf);
|
logf("NO MATCH: %s\n", buf);
|
||||||
if (buf[0] == '?')
|
if (buf[0] == '?')
|
||||||
|
|
@ -151,6 +151,7 @@ static int get_clause(int *condition)
|
||||||
buf[i] = '\0';
|
buf[i] = '\0';
|
||||||
|
|
||||||
MATCH(condition, buf, "=", clause_is);
|
MATCH(condition, buf, "=", clause_is);
|
||||||
|
MATCH(condition, buf, "==", clause_is);
|
||||||
MATCH(condition, buf, ">", clause_gt);
|
MATCH(condition, buf, ">", clause_gt);
|
||||||
MATCH(condition, buf, ">=", clause_gteq);
|
MATCH(condition, buf, ">=", clause_gteq);
|
||||||
MATCH(condition, buf, "<", clause_lt);
|
MATCH(condition, buf, "<", clause_lt);
|
||||||
|
|
@ -386,6 +387,7 @@ int retrieve_entries(struct tree_context *c, struct tagcache_search *tcs,
|
||||||
int namebufused = 0;
|
int namebufused = 0;
|
||||||
int total_count = 0;
|
int total_count = 0;
|
||||||
int extra = c->currextra;
|
int extra = c->currextra;
|
||||||
|
int tag;
|
||||||
bool sort = false;
|
bool sort = false;
|
||||||
|
|
||||||
if (init
|
if (init
|
||||||
|
|
@ -399,7 +401,15 @@ int retrieve_entries(struct tree_context *c, struct tagcache_search *tcs,
|
||||||
0, csi->name);
|
0, csi->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tagcache_search(tcs, csi->tagorder[extra]))
|
if (c->currtable == allsubentries)
|
||||||
|
{
|
||||||
|
tag = tag_title;
|
||||||
|
extra--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tag = csi->tagorder[extra];
|
||||||
|
|
||||||
|
if (!tagcache_search(tcs, tag))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < extra; i++)
|
for (i = 0; i < extra; i++)
|
||||||
|
|
@ -417,19 +427,37 @@ int retrieve_entries(struct tree_context *c, struct tagcache_search *tcs,
|
||||||
current_offset = offset;
|
current_offset = offset;
|
||||||
current_entry_count = 0;
|
current_entry_count = 0;
|
||||||
c->dirfull = false;
|
c->dirfull = false;
|
||||||
|
|
||||||
|
if (tag != tag_title)
|
||||||
|
{
|
||||||
|
if (offset == 0)
|
||||||
|
{
|
||||||
|
dptr->newtable = allsubentries;
|
||||||
|
dptr->name = str(LANG_TAGNAVI_ALL_TRACKS);
|
||||||
|
dptr++;
|
||||||
|
current_entry_count++;
|
||||||
|
}
|
||||||
|
total_count++;
|
||||||
|
}
|
||||||
|
|
||||||
while (tagcache_get_next(tcs))
|
while (tagcache_get_next(tcs))
|
||||||
{
|
{
|
||||||
if (total_count++ < offset)
|
if (total_count++ < offset)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
dptr->newtable = tcs->result_seek;
|
dptr->newtable = navibrowse;
|
||||||
if (!tcs->ramsearch || csi->tagorder[extra] == tag_title)
|
dptr->extraseek = tcs->result_seek;
|
||||||
|
if (!tcs->ramsearch || tag == tag_title)
|
||||||
{
|
{
|
||||||
int tracknum = -1;
|
int tracknum = -1;
|
||||||
|
|
||||||
dptr->name = &c->name_buffer[namebufused];
|
dptr->name = &c->name_buffer[namebufused];
|
||||||
if (csi->tagorder[extra] == tag_title)
|
if (tag == tag_title)
|
||||||
|
{
|
||||||
|
dptr->newtable = playtrack;
|
||||||
|
if (c->currtable != allsubentries && c->dirlevel > 1)
|
||||||
tracknum = tagcache_get_numeric(tcs, tag_tracknumber);
|
tracknum = tagcache_get_numeric(tcs, tag_tracknumber);
|
||||||
|
}
|
||||||
|
|
||||||
if (tracknum > 0)
|
if (tracknum > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -544,6 +572,7 @@ int tagtree_load(struct tree_context* c)
|
||||||
count = load_root(c);
|
count = load_root(c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case allsubentries:
|
||||||
case navibrowse:
|
case navibrowse:
|
||||||
logf("navibrowse...");
|
logf("navibrowse...");
|
||||||
count = retrieve_entries(c, &tcs, 0, true);
|
count = retrieve_entries(c, &tcs, 0, true);
|
||||||
|
|
@ -572,11 +601,13 @@ int tagtree_enter(struct tree_context* c)
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct tagentry *dptr;
|
struct tagentry *dptr;
|
||||||
int newextra;
|
int newextra;
|
||||||
|
int seek;
|
||||||
|
|
||||||
dptr = tagtree_get_entry(c, c->selected_item);
|
dptr = tagtree_get_entry(c, c->selected_item);
|
||||||
|
|
||||||
c->dirfull = false;
|
c->dirfull = false;
|
||||||
newextra = dptr->newtable;
|
newextra = dptr->newtable;
|
||||||
|
seek = dptr->extraseek;
|
||||||
|
|
||||||
if (c->dirlevel >= MAX_DIR_LEVELS)
|
if (c->dirlevel >= MAX_DIR_LEVELS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -595,7 +626,7 @@ int tagtree_enter(struct tree_context* c)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
csi = si+dptr->extraseek;
|
csi = si+seek;
|
||||||
c->currextra = 0;
|
c->currextra = 0;
|
||||||
|
|
||||||
/* Read input as necessary. */
|
/* Read input as necessary. */
|
||||||
|
|
@ -621,30 +652,33 @@ int tagtree_enter(struct tree_context* c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c->currtable = newextra;
|
c->currtable = newextra;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case navibrowse:
|
case navibrowse:
|
||||||
csi->result_seek[c->currextra] = newextra;
|
case allsubentries:
|
||||||
if (c->currextra < csi->tagorder_count-1)
|
if (newextra == playtrack)
|
||||||
{
|
{
|
||||||
c->currextra++;
|
c->dirlevel--;
|
||||||
|
if (tagtree_play_folder(c) >= 0)
|
||||||
|
rc = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c->currtable = newextra;
|
||||||
|
csi->result_seek[c->currextra] = seek;
|
||||||
|
if (c->currextra < csi->tagorder_count-1)
|
||||||
|
c->currextra++;
|
||||||
|
else
|
||||||
c->dirlevel--;
|
c->dirlevel--;
|
||||||
if (csi->tagorder[c->currextra] == tag_title)
|
|
||||||
{
|
|
||||||
if (tagtree_play_folder(c) >= 0)
|
|
||||||
rc = 2;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
c->dirlevel--;
|
c->dirlevel--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->selected_item=0;
|
c->selected_item=0;
|
||||||
gui_synclist_select_item(&tree_lists, c->selected_item);
|
gui_synclist_select_item(&tree_lists, c->selected_item);
|
||||||
|
|
||||||
|
|
@ -674,7 +708,7 @@ int tagtree_get_filename(struct tree_context* c, char *buf, int buflen)
|
||||||
if (!tagcache_search(&tcs, tag_filename))
|
if (!tagcache_search(&tcs, tag_filename))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
tagcache_search_add_filter(&tcs, tag_title, entry->newtable);
|
tagcache_search_add_filter(&tcs, tag_title, entry->extraseek);
|
||||||
|
|
||||||
if (!tagcache_get_next(&tcs))
|
if (!tagcache_get_next(&tcs))
|
||||||
{
|
{
|
||||||
|
|
@ -711,7 +745,7 @@ static int tagtree_play_folder(struct tree_context* c)
|
||||||
if (!show_search_progress(false, i))
|
if (!show_search_progress(false, i))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!tagcache_retrieve(&tcs, tagtree_get_entry(c, i)->newtable,
|
if (!tagcache_retrieve(&tcs, tagtree_get_entry(c, i)->extraseek,
|
||||||
buf, sizeof buf))
|
buf, sizeof buf))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -769,6 +803,10 @@ int tagtree_get_icon(struct tree_context* c)
|
||||||
icon = Icon_Folder;
|
icon = Icon_Folder;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case allsubentries:
|
||||||
|
icon = Icon_Audio;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
icon = Icon_Folder;
|
icon = Icon_Folder;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "tagcache.h"
|
#include "tagcache.h"
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
|
|
||||||
enum table { invalid, root, navibrowse };
|
enum table { root = 1, navibrowse, allsubentries, playtrack };
|
||||||
|
|
||||||
struct tagentry {
|
struct tagentry {
|
||||||
char *name;
|
char *name;
|
||||||
|
|
|
||||||
|
|
@ -315,8 +315,8 @@ while(<LANG>) {
|
||||||
push @phrase, $ll;
|
push @phrase, $ll;
|
||||||
|
|
||||||
# this is an XML-lookalike tag
|
# this is an XML-lookalike tag
|
||||||
if(/ *<([^>]*)>/) {
|
if (/^(<|[^\"<]+<)([^>]*)>/) {
|
||||||
my $part = $1;
|
my $part = $2;
|
||||||
# print "P: $part\n";
|
# print "P: $part\n";
|
||||||
|
|
||||||
if($part =~ /^\//) {
|
if($part =~ /^\//) {
|
||||||
|
|
@ -409,7 +409,7 @@ while(<LANG>) {
|
||||||
# This is an opening (sub) tag
|
# This is an opening (sub) tag
|
||||||
|
|
||||||
push @m, $m; # store old value
|
push @m, $m; # store old value
|
||||||
$m = $1;
|
$m = $part;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue