Index: apps/tagcache.c =================================================================== --- apps/tagcache.c (revision 18853) +++ apps/tagcache.c (working copy) @@ -84,6 +84,7 @@ #include "lang.h" #include "eeprom_settings.h" #endif +#include "albumart.h" #ifdef __PCTOOL__ #define yield() do { } while(0) @@ -112,11 +113,12 @@ /* Tags we want to get sorted (loaded to the tempbuf). */ static const int sorted_tags[] = { tag_artist, tag_album, tag_genre, - tag_composer, tag_comment, tag_albumartist, tag_grouping, tag_title }; + tag_composer, tag_comment, tag_albumartist, tag_grouping, tag_cover, + tag_title }; /* Uniqued tags (we can use these tags with filters and conditional clauses). */ static const int unique_tags[] = { tag_artist, tag_album, tag_genre, - tag_composer, tag_comment, tag_albumartist, tag_grouping }; + tag_composer, tag_comment, tag_albumartist, tag_grouping, tag_cover }; /* Numeric tags (we can use these tags with conditional clauses). */ static const int numeric_tags[] = { tag_year, tag_discnumber, @@ -128,7 +130,7 @@ /* String presentation of the tags defined in tagcache.h. Must be in correct order! */ static const char *tags_str[] = { "artist", "album", "genre", "title", - "filename", "composer", "comment", "albumartist", "grouping", "year", + "filename", "composer", "comment", "albumartist", "grouping", "cover", "year", "discnumber", "tracknumber", "bitrate", "length", "playcount", "rating", "playtime", "lastplayed", "commitid", "mtime" }; @@ -194,7 +196,7 @@ /** Note: This should be (1 + TAG_COUNT) amount of l's. */ -static const char *index_entry_ec = "lllllllllllllllllllll"; +static const char *index_entry_ec = "llllllllllllllllllllll"; static const char *tagcache_header_ec = "lll"; static const char *master_header_ec = "llllll"; @@ -1663,6 +1665,7 @@ int path_length = strlen(path); bool has_albumartist; bool has_grouping; + char buf[MAX_PATH]="", *cover=buf; if (cachefd < 0) return ; @@ -1736,6 +1739,8 @@ ret = get_metadata(&id3, fd, path); close(fd); + search_albumart_files(&id3, "", cover, MAX_PATH); + if (!ret) return ; @@ -1810,6 +1815,7 @@ { ADD_TAG(entry, tag_grouping, &id3.title); } + ADD_TAG(entry, tag_cover, &cover); entry.data_length = offset; /* Write the header */ @@ -1839,6 +1845,7 @@ { write_item(id3.title); } + write_item(cover); total_entry_count++; } Index: apps/tagcache.h =================================================================== --- apps/tagcache.h (revision 18853) +++ apps/tagcache.h (working copy) @@ -29,8 +29,9 @@ tagcache.c and bump up the header version too. */ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title, - tag_filename, tag_composer, tag_comment, tag_albumartist, tag_grouping, tag_year, - tag_discnumber, tag_tracknumber, tag_bitrate, tag_length, tag_playcount, tag_rating, + tag_filename, tag_composer, tag_comment, tag_albumartist, tag_grouping, + tag_cover, tag_year, tag_discnumber, tag_tracknumber, tag_bitrate, + tag_length, tag_playcount, tag_rating, tag_playtime, tag_lastplayed, tag_commitid, tag_mtime, /* Real tags end here, count them. */ TAG_COUNT, @@ -49,7 +50,7 @@ #define IDX_BUF_DEPTH 64 /* Tag Cache Header version 'TCHxx'. Increment when changing internal structures. */ -#define TAGCACHE_MAGIC 0x5443480c +#define TAGCACHE_MAGIC 0x5443480d /* How much to allocate extra space for ramcache. */ #define TAGCACHE_RESERVE 32768 Index: apps/tagnavi.config =================================================================== --- apps/tagnavi.config (revision 18853) +++ apps/tagnavi.config (working copy) @@ -147,6 +147,14 @@ "Album" -> title = "fmt_title" ? album = "#album#" "Composer" -> title = "fmt_title" ? composer = "#composer#" +# Define the "cover" sub menu +%menu_start "cover" "Cover by..." +"Genre" -> genre -> cover -> title = "fmt_title" +"Artist" -> artist -> cover -> title = "fmt_title" +"Composer" -> composer -> cover -> title = "fmt_title" +"Year" -> year -> cover -> title = "fmt_title" +"All" -> cover -> title = "fmt_title" + # Define the runtime sub menu %menu_start "runtime" "Play history" "Most played (Plays|Score)" -> title = "fmt_mostplayed" ? playcount > "0" @@ -177,6 +185,7 @@ "History..." ==> "runtime" "Same as current..." ==> "same" "Search..." ==> "search" +"Cover by..." ==> "cover" "Custom view..." ==> "custom" # And finally set main menu as our root menu Index: apps/tagtree.c =================================================================== --- apps/tagtree.c (revision 18853) +++ apps/tagtree.c (working copy) @@ -216,6 +216,7 @@ MATCH(tag, buf, "albumartist", tag_albumartist); MATCH(tag, buf, "ensemble", tag_albumartist); MATCH(tag, buf, "grouping", tag_grouping); + MATCH(tag, buf, "cover", tag_cover); MATCH(tag, buf, "genre", tag_genre); MATCH(tag, buf, "length", tag_length); MATCH(tag, buf, "Lm", tag_virt_length_min);