diff options
author | James D. Smith <smithjd15@gmail.com> | 2021-09-15 17:33:41 -0600 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2021-09-17 21:42:05 -0400 |
commit | fcb9c068526cf1e565a05e6b6ccc50dc3e5ba0d5 (patch) | |
tree | f79396dc163111233d4edd175ce8535435536a1e /apps | |
parent | cb0f4599e1557bf23267f4c3f2887513343c52b9 (diff) | |
download | rockbox-fcb9c068526cf1e565a05e6b6ccc50dc3e5ba0d5.tar.gz rockbox-fcb9c068526cf1e565a05e6b6ccc50dc3e5ba0d5.zip |
Database: Fix tag_albumartist; new tag_virt_canonicalartist.
Change-Id: I1d887f8a9d6690b8286407d2502432b0497cfeb9
Diffstat (limited to 'apps')
-rw-r--r-- | apps/tagcache.c | 35 | ||||
-rw-r--r-- | apps/tagcache.h | 10 | ||||
-rw-r--r-- | apps/tagtree.c | 1 |
3 files changed, 26 insertions, 20 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c index 2e705d658e..bf23ac74dc 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -118,7 +118,7 @@ static long tempbuf_pos; | |||
118 | static int tempbuf_handle; | 118 | static int tempbuf_handle; |
119 | #endif | 119 | #endif |
120 | 120 | ||
121 | #define SORTED_TAGS_COUNT 8 | 121 | #define SORTED_TAGS_COUNT 9 |
122 | #define TAGCACHE_IS_UNIQUE(tag) (BIT_N(tag) & TAGCACHE_UNIQUE_TAGS) | 122 | #define TAGCACHE_IS_UNIQUE(tag) (BIT_N(tag) & TAGCACHE_UNIQUE_TAGS) |
123 | #define TAGCACHE_IS_SORTED(tag) (BIT_N(tag) & TAGCACHE_SORTED_TAGS) | 123 | #define TAGCACHE_IS_SORTED(tag) (BIT_N(tag) & TAGCACHE_SORTED_TAGS) |
124 | #define TAGCACHE_IS_NUMERIC_OR_NONUNIQUE(tag) \ | 124 | #define TAGCACHE_IS_NUMERIC_OR_NONUNIQUE(tag) \ |
@@ -126,18 +126,21 @@ static int tempbuf_handle; | |||
126 | /* Tags we want to get sorted (loaded to the tempbuf). */ | 126 | /* Tags we want to get sorted (loaded to the tempbuf). */ |
127 | #define TAGCACHE_SORTED_TAGS ((1LU << tag_artist) | (1LU << tag_album) | \ | 127 | #define TAGCACHE_SORTED_TAGS ((1LU << tag_artist) | (1LU << tag_album) | \ |
128 | (1LU << tag_genre) | (1LU << tag_composer) | (1LU << tag_comment) | \ | 128 | (1LU << tag_genre) | (1LU << tag_composer) | (1LU << tag_comment) | \ |
129 | (1LU << tag_albumartist) | (1LU << tag_grouping) | (1LU << tag_title)) | 129 | (1LU << tag_albumartist) | (1LU << tag_grouping) | (1LU << tag_title) | \ |
130 | (1LU << tag_virt_canonicalartist)) | ||
130 | 131 | ||
131 | /* Uniqued tags (we can use these tags with filters and conditional clauses). */ | 132 | /* Uniqued tags (we can use these tags with filters and conditional clauses). */ |
132 | #define TAGCACHE_UNIQUE_TAGS ((1LU << tag_artist) | (1LU << tag_album) | \ | 133 | #define TAGCACHE_UNIQUE_TAGS ((1LU << tag_artist) | (1LU << tag_album) | \ |
133 | (1LU << tag_genre) | (1LU << tag_composer) | (1LU << tag_comment) | \ | 134 | (1LU << tag_genre) | (1LU << tag_composer) | (1LU << tag_comment) | \ |
134 | (1LU << tag_albumartist) | (1LU << tag_grouping)) | 135 | (1LU << tag_albumartist) | (1LU << tag_grouping) | \ |
136 | (1LU << tag_virt_canonicalartist)) | ||
135 | 137 | ||
136 | /* String presentation of the tags defined in tagcache.h. Must be in correct order! */ | 138 | /* String presentation of the tags defined in tagcache.h. Must be in correct order! */ |
137 | static const char *tags_str[] = { "artist", "album", "genre", "title", | 139 | static const char *tags_str[] = { "artist", "album", "genre", "title", |
138 | "filename", "composer", "comment", "albumartist", "grouping", "year", | 140 | "filename", "composer", "comment", "albumartist", "grouping", "year", |
139 | "discnumber", "tracknumber", "bitrate", "length", "playcount", "rating", | 141 | "discnumber", "tracknumber", "canonicalartist", "bitrate", "length", |
140 | "playtime", "lastplayed", "commitid", "mtime", "lastelapsed", "lastoffset" }; | 142 | "playcount", "rating", "playtime", "lastplayed", "commitid", "mtime", |
143 | "lastelapsed", "lastoffset" }; | ||
141 | 144 | ||
142 | /* Status information of the tagcache. */ | 145 | /* Status information of the tagcache. */ |
143 | static struct tagcache_stat tc_stat; | 146 | static struct tagcache_stat tc_stat; |
@@ -203,7 +206,7 @@ static const char * const tagfile_entry_ec = "ll"; | |||
203 | /** | 206 | /** |
204 | Note: This should be (1 + TAG_COUNT) amount of l's. | 207 | Note: This should be (1 + TAG_COUNT) amount of l's. |
205 | */ | 208 | */ |
206 | static const char * const index_entry_ec = "lllllllllllllllllllllll"; | 209 | static const char * const index_entry_ec = "llllllllllllllllllllllll"; |
207 | 210 | ||
208 | static const char * const tagcache_header_ec = "lll"; | 211 | static const char * const tagcache_header_ec = "lll"; |
209 | static const char * const master_header_ec = "llllll"; | 212 | static const char * const master_header_ec = "llllll"; |
@@ -1896,7 +1899,7 @@ static void NO_INLINE add_tagcache(char *path, unsigned long mtime) | |||
1896 | char tracknumfix[3]; | 1899 | char tracknumfix[3]; |
1897 | int offset = 0; | 1900 | int offset = 0; |
1898 | int path_length = strlen(path); | 1901 | int path_length = strlen(path); |
1899 | bool has_albumartist; | 1902 | bool has_artist; |
1900 | bool has_grouping; | 1903 | bool has_grouping; |
1901 | 1904 | ||
1902 | #ifdef SIMULATOR | 1905 | #ifdef SIMULATOR |
@@ -1996,8 +1999,8 @@ static void NO_INLINE add_tagcache(char *path, unsigned long mtime) | |||
1996 | entry.tag_offset[tag_mtime] = mtime; | 1999 | entry.tag_offset[tag_mtime] = mtime; |
1997 | 2000 | ||
1998 | /* String tags. */ | 2001 | /* String tags. */ |
1999 | has_albumartist = id3.albumartist != NULL | 2002 | has_artist = id3.artist != NULL |
2000 | && strlen(id3.albumartist) > 0; | 2003 | && strlen(id3.artist) > 0; |
2001 | has_grouping = id3.grouping != NULL | 2004 | has_grouping = id3.grouping != NULL |
2002 | && strlen(id3.grouping) > 0; | 2005 | && strlen(id3.grouping) > 0; |
2003 | 2006 | ||
@@ -2008,13 +2011,14 @@ static void NO_INLINE add_tagcache(char *path, unsigned long mtime) | |||
2008 | ADD_TAG(entry, tag_genre, &id3.genre_string); | 2011 | ADD_TAG(entry, tag_genre, &id3.genre_string); |
2009 | ADD_TAG(entry, tag_composer, &id3.composer); | 2012 | ADD_TAG(entry, tag_composer, &id3.composer); |
2010 | ADD_TAG(entry, tag_comment, &id3.comment); | 2013 | ADD_TAG(entry, tag_comment, &id3.comment); |
2011 | if (has_albumartist) | 2014 | ADD_TAG(entry, tag_albumartist, &id3.albumartist); |
2015 | if (has_artist) | ||
2012 | { | 2016 | { |
2013 | ADD_TAG(entry, tag_albumartist, &id3.albumartist); | 2017 | ADD_TAG(entry, tag_virt_canonicalartist, &id3.artist); |
2014 | } | 2018 | } |
2015 | else | 2019 | else |
2016 | { | 2020 | { |
2017 | ADD_TAG(entry, tag_albumartist, &id3.artist); | 2021 | ADD_TAG(entry, tag_virt_canonicalartist, &id3.albumartist); |
2018 | } | 2022 | } |
2019 | if (has_grouping) | 2023 | if (has_grouping) |
2020 | { | 2024 | { |
@@ -2037,13 +2041,14 @@ static void NO_INLINE add_tagcache(char *path, unsigned long mtime) | |||
2037 | write_item(id3.genre_string); | 2041 | write_item(id3.genre_string); |
2038 | write_item(id3.composer); | 2042 | write_item(id3.composer); |
2039 | write_item(id3.comment); | 2043 | write_item(id3.comment); |
2040 | if (has_albumartist) | 2044 | write_item(id3.albumartist); |
2045 | if (has_artist) | ||
2041 | { | 2046 | { |
2042 | write_item(id3.albumartist); | 2047 | write_item(id3.artist); |
2043 | } | 2048 | } |
2044 | else | 2049 | else |
2045 | { | 2050 | { |
2046 | write_item(id3.artist); | 2051 | write_item(id3.albumartist); |
2047 | } | 2052 | } |
2048 | if (has_grouping) | 2053 | if (has_grouping) |
2049 | { | 2054 | { |
diff --git a/apps/tagcache.h b/apps/tagcache.h index 0a240b15a0..b64571de40 100644 --- a/apps/tagcache.h +++ b/apps/tagcache.h | |||
@@ -31,10 +31,10 @@ | |||
31 | tagcache.c and bump up the header version too. | 31 | tagcache.c and bump up the header version too. |
32 | */ | 32 | */ |
33 | enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title, | 33 | enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title, |
34 | tag_filename, tag_composer, tag_comment, tag_albumartist, tag_grouping, tag_year, | 34 | tag_filename, tag_composer, tag_comment, tag_albumartist, tag_grouping, tag_year, |
35 | tag_discnumber, tag_tracknumber, tag_bitrate, tag_length, tag_playcount, tag_rating, | 35 | tag_discnumber, tag_tracknumber, tag_virt_canonicalartist, tag_bitrate, tag_length, |
36 | tag_playtime, tag_lastplayed, tag_commitid, tag_mtime, tag_lastelapsed, | 36 | tag_playcount, tag_rating, tag_playtime, tag_lastplayed, tag_commitid, tag_mtime, |
37 | tag_lastoffset, | 37 | tag_lastelapsed, tag_lastoffset, |
38 | /* Real tags end here, count them. */ | 38 | /* Real tags end here, count them. */ |
39 | TAG_COUNT, | 39 | TAG_COUNT, |
40 | /* Virtual tags */ | 40 | /* Virtual tags */ |
@@ -52,7 +52,7 @@ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title, | |||
52 | #define IDX_BUF_DEPTH 64 | 52 | #define IDX_BUF_DEPTH 64 |
53 | 53 | ||
54 | /* Tag Cache Header version 'TCHxx'. Increment when changing internal structures. */ | 54 | /* Tag Cache Header version 'TCHxx'. Increment when changing internal structures. */ |
55 | #define TAGCACHE_MAGIC 0x5443480f | 55 | #define TAGCACHE_MAGIC 0x54434810 |
56 | 56 | ||
57 | /* Dump store/restore header version 'TCSxx'. */ | 57 | /* Dump store/restore header version 'TCSxx'. */ |
58 | #define TAGCACHE_STATEFILE_MAGIC 0x54435301 | 58 | #define TAGCACHE_STATEFILE_MAGIC 0x54435301 |
diff --git a/apps/tagtree.c b/apps/tagtree.c index 4b118f6d0d..454875ded2 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c | |||
@@ -338,6 +338,7 @@ static int get_tag(int *tag) | |||
338 | {"filename", tag_filename}, | 338 | {"filename", tag_filename}, |
339 | {"basename", tag_virt_basename}, | 339 | {"basename", tag_virt_basename}, |
340 | {"tracknum", tag_tracknumber}, | 340 | {"tracknum", tag_tracknumber}, |
341 | {"canonicalartist", tag_virt_canonicalartist}, | ||
341 | {"discnum", tag_discnumber}, | 342 | {"discnum", tag_discnumber}, |
342 | {"year", tag_year}, | 343 | {"year", tag_year}, |
343 | {"playcount", tag_playcount}, | 344 | {"playcount", tag_playcount}, |