Index: apps/tagcache.c =================================================================== --- apps/tagcache.c (Revision 18351) +++ apps/tagcache.c (Arbeitskopie) @@ -82,6 +82,7 @@ #include "lang.h" #include "eeprom_settings.h" #endif +#include "albumart.h" #ifdef __PCTOOL__ #define yield() do { } while(0) @@ -111,11 +112,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, @@ -127,8 +129,8 @@ /* 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", - "discnumber", "tracknumber", "bitrate", "length", "playcount", "rating", + "filename", "composer", "comment", "albumartist", "grouping", "cover", + "year", "discnumber", "tracknumber", "bitrate", "length", "playcount", "rating", "playtime", "lastplayed", "commitid", "mtime" }; /* Status information of the tagcache. */ @@ -190,7 +192,7 @@ /* For the endianess correction */ static const char *tagfile_entry_ec = "ss"; -static const char *index_entry_ec = "lllllllllllllllllllll"; /* (1 + TAG_COUNT) * l */ +static const char *index_entry_ec = "llllllllllllllllllllll"; /* (1 + TAG_COUNT) * l */ static const char *tagcache_header_ec = "lll"; static const char *master_header_ec = "llllll"; @@ -1657,6 +1659,7 @@ int path_length = strlen(path); bool has_albumartist; bool has_grouping; + char buf[MAX_PATH]="", *cover=buf; if (cachefd < 0) return ; @@ -1727,6 +1730,8 @@ ret = get_metadata(&id3, fd, path); close(fd); + search_albumart_files(&id3, ".100x100", cover, MAX_PATH); + if (!ret) return ; @@ -1801,6 +1806,7 @@ { ADD_TAG(entry, tag_grouping, &id3.title); } + ADD_TAG(entry, tag_cover, &cover); entry.data_length = offset; /* Write the header */ @@ -1830,6 +1836,7 @@ { write_item(id3.title); } + write_item(cover); total_entry_count++; } Index: apps/tagcache.h =================================================================== --- apps/tagcache.h (Revision 18351) +++ apps/tagcache.h (Arbeitskopie) @@ -25,15 +25,16 @@ #include "id3.h" 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, /* Virtual tags */ tag_virt_length_min, tag_virt_length_sec, tag_virt_playtime_min, tag_virt_playtime_sec, tag_virt_entryage, tag_virt_autoscore }; -#define TAG_COUNT 20 +#define TAG_COUNT 21 /* Maximum length of a single tag. */ #define TAG_MAXLEN (MAX_PATH*2) @@ -45,7 +46,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 18351) +++ apps/tagnavi.config (Arbeitskopie) @@ -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 18351) +++ apps/tagtree.c (Arbeitskopie) @@ -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);