summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2007-04-12 20:14:05 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2007-04-12 20:14:05 +0000
commit9d9937a0ad64018a7e8beb503f7207696e694856 (patch)
tree33b8686cb06727fd7012917dd75cd1e8dcc6780f
parentec88dffb6cde1b0e88c813e1676c8e989668fd9b (diff)
downloadrockbox-9d9937a0ad64018a7e8beb503f7207696e694856.tar.gz
rockbox-9d9937a0ad64018a7e8beb503f7207696e694856.tar.bz2
rockbox-9d9937a0ad64018a7e8beb503f7207696e694856.zip
Added virtual tags in database to break track length to minutes and seconds.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13132 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/tagcache.c9
-rw-r--r--apps/tagcache.h1
-rw-r--r--apps/tagnavi.config4
-rw-r--r--apps/tagtree.c2
4 files changed, 14 insertions, 2 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 7a1fec75af..c22091ecf5 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -116,6 +116,7 @@ static const int unique_tags[] = { tag_artist, tag_album, tag_genre,
/* Numeric tags (we can use these tags with conditional clauses). */
static const int numeric_tags[] = { tag_year, tag_tracknumber, tag_length,
tag_bitrate, tag_playcount, tag_rating, tag_playtime, tag_lastplayed, tag_commitid,
+ tag_virt_length_min, tag_virt_length_sec,
tag_virt_entryage, tag_virt_autoscore };
/* String presentation of the tags defined in tagcache.h. Must be in correct order! */
@@ -659,6 +660,14 @@ static long check_virtual_tags(int tag, const struct index_entry *idx)
switch (tag)
{
+ case tag_virt_length_sec:
+ data = (idx->tag_seek[tag_length]/1000) % 60;
+ break;
+
+ case tag_virt_length_min:
+ data = (idx->tag_seek[tag_length]/1000) / 60;
+ break;
+
case tag_virt_autoscore:
if (idx->tag_seek[tag_length] == 0
|| idx->tag_seek[tag_playcount] == 0)
diff --git a/apps/tagcache.h b/apps/tagcache.h
index 7b7aa021c3..f449f1344e 100644
--- a/apps/tagcache.h
+++ b/apps/tagcache.h
@@ -27,6 +27,7 @@ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title,
tag_tracknumber, tag_bitrate, tag_length, tag_playcount, tag_rating,
tag_playtime, tag_lastplayed, tag_commitid,
/* Virtual tags */
+ tag_virt_length_min, tag_virt_length_sec,
tag_virt_entryage, tag_virt_autoscore };
#define TAG_COUNT 17
diff --git a/apps/tagnavi.config b/apps/tagnavi.config
index 7c8e06c9e1..2c5675f5b7 100644
--- a/apps/tagnavi.config
+++ b/apps/tagnavi.config
@@ -6,8 +6,8 @@
# get overwritten automatically.
# Basic format declarations
-%format "fmt_title" "%02d. %s" tracknum title ? tracknum > "0"
-%format "fmt_title" "%s" title
+%format "fmt_title" "%02d. %s - %02d:%02d" tracknum title Lm Ls ? tracknum > "0"
+%format "fmt_title" "%s - %02d:%02d" title Lm Ls
%format "fmt_mostplayed" "%2d|%3d %s (%s)" playcount autoscore title artist %sort = "inverse" %limit = "100"
%format "fmt_lastplayed" "%06d%s - %s" lastplayed artist title %sort = "inverse" %limit = "99" %strip = "6"
%format "fmt_forgotten" "%06d%s - %s" lastplayed artist title %limit = "99" %strip = "6"
diff --git a/apps/tagtree.c b/apps/tagtree.c
index e9370fa443..cc8c1456e6 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -200,6 +200,8 @@ static int get_tag(int *tag)
MATCH(tag, buf, "ensemble", tag_albumartist);
MATCH(tag, buf, "genre", tag_genre);
MATCH(tag, buf, "length", tag_length);
+ MATCH(tag, buf, "Lm", tag_virt_length_min);
+ MATCH(tag, buf, "Ls", tag_virt_length_sec);
MATCH(tag, buf, "title", tag_title);
MATCH(tag, buf, "filename", tag_filename);
MATCH(tag, buf, "tracknum", tag_tracknumber);