mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
New option "strip" to make it possible hide data used for sorting.
Example with "last played tracks". git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11066 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
2dbe428abc
commit
8d145f6d0d
2 changed files with 28 additions and 1 deletions
|
|
@ -36,6 +36,7 @@
|
|||
"Year" -> year ? year > "1000" & year < "2008" -> artist -> album -> title = "%02d. %s" tracknum title
|
||||
"Search..." ==> "search"
|
||||
"Most played tracks" -> title = "(%3d) %s" playcount title %sort = "inverse" %limit = "100" ? playcount > "0"
|
||||
"Last played tracks" -> title = "%06d%s" lastplayed title %sort = "inverse" %limit = "99" %strip = "6" ? playcount > "0"
|
||||
"Never played tracks" -> artist ? playcount == "0" -> album -> title = "%02d. %s" tracknum title
|
||||
"Best tracks" -> artist ? playcount > "1" & autoscore > "85" -> album -> title = "%02d. %s (%3d)" tracknum title autoscore
|
||||
"List played tracks" -> title = "(%3d/%d) %s" autoscore playcount title ? playcount > "0"
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ static char searchstring[32];
|
|||
enum variables {
|
||||
var_sorttype = 100,
|
||||
var_limit,
|
||||
var_strip,
|
||||
var_menu_start,
|
||||
var_include,
|
||||
var_rootmenu,
|
||||
|
|
@ -87,6 +88,7 @@ struct display_format {
|
|||
int tag_count;
|
||||
|
||||
int limit;
|
||||
int strip;
|
||||
bool sort_inverse;
|
||||
};
|
||||
|
||||
|
|
@ -194,6 +196,7 @@ static int get_tag(int *tag)
|
|||
MATCH(tag, buf, "autoscore", tag_virt_autoscore);
|
||||
MATCH(tag, buf, "%sort", var_sorttype);
|
||||
MATCH(tag, buf, "%limit", var_limit);
|
||||
MATCH(tag, buf, "%strip", var_strip);
|
||||
MATCH(tag, buf, "%menu_start", var_menu_start);
|
||||
MATCH(tag, buf, "%include", var_include);
|
||||
MATCH(tag, buf, "%root_menu", var_rootmenu);
|
||||
|
|
@ -338,6 +341,12 @@ static int get_format_str(struct display_format *fmt)
|
|||
fmt->limit = atoi(buf);
|
||||
break;
|
||||
|
||||
case var_strip:
|
||||
if (!read_variable(buf, sizeof buf))
|
||||
return -14;
|
||||
fmt->strip = atoi(buf);
|
||||
break;
|
||||
|
||||
default:
|
||||
fmt->tag_count++;
|
||||
}
|
||||
|
|
@ -786,7 +795,8 @@ int retrieve_entries(struct tree_context *c, struct tagcache_search *tcs,
|
|||
int level = c->currextra;
|
||||
int tag;
|
||||
bool sort = false;
|
||||
int sort_limit = 0;
|
||||
int sort_limit;
|
||||
int strip;
|
||||
|
||||
if (init
|
||||
#ifdef HAVE_TC_RAMCACHE
|
||||
|
|
@ -852,11 +862,13 @@ int retrieve_entries(struct tree_context *c, struct tagcache_search *tcs,
|
|||
{
|
||||
sort_inverse = fmt->sort_inverse;
|
||||
sort_limit = fmt->limit;
|
||||
strip = fmt->strip;
|
||||
}
|
||||
else
|
||||
{
|
||||
sort_inverse = false;
|
||||
sort_limit = 0;
|
||||
strip = 0;
|
||||
}
|
||||
|
||||
if (tag != tag_title && tag != tag_filename)
|
||||
|
|
@ -1029,6 +1041,20 @@ int retrieve_entries(struct tree_context *c, struct tagcache_search *tcs,
|
|||
if (sort_limit)
|
||||
total_count = MIN(total_count, sort_limit);
|
||||
|
||||
if (strip)
|
||||
{
|
||||
dptr = c->dircache;
|
||||
for (i = 0; i < total_count; i++, dptr++)
|
||||
{
|
||||
int len = strlen(dptr->name);
|
||||
|
||||
if (len < strip)
|
||||
continue;
|
||||
|
||||
dptr->name = &dptr->name[strip];
|
||||
}
|
||||
}
|
||||
|
||||
return total_count;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue