From 00dd14922b48ca29411d9ae3445dc5d92d050422 Mon Sep 17 00:00:00 2001 From: Dan Everton Date: Mon, 25 Jun 2007 11:33:21 +0000 Subject: When building the database and a track doesn't have an album artist tag, copy the value from the artist tag. This should make browsing through album artist in the database a bit nicer. Same as FS# 7342 but different. You may need to rebuild your database to actually see any change. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13710 a1c6a512-1295-4272-9138-f99709370657 --- apps/tagcache.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'apps/tagcache.c') diff --git a/apps/tagcache.c b/apps/tagcache.c index d82149ad3b..41138ddf2c 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -1595,6 +1595,7 @@ static void add_tagcache(char *path) char tracknumfix[3]; int offset = 0; int path_length = strlen(path); + bool has_albumartist; if (cachefd < 0) return ; @@ -1685,6 +1686,9 @@ static void add_tagcache(char *path) entry.tag_offset[tag_bitrate] = track.id3.bitrate; /* String tags. */ + has_albumartist = track.id3.albumartist != NULL + && strlen(track.id3.albumartist) > 0; + ADD_TAG(entry, tag_filename, &path); ADD_TAG(entry, tag_title, &track.id3.title); ADD_TAG(entry, tag_artist, &track.id3.artist); @@ -1692,7 +1696,14 @@ static void add_tagcache(char *path) ADD_TAG(entry, tag_genre, &track.id3.genre_string); ADD_TAG(entry, tag_composer, &track.id3.composer); ADD_TAG(entry, tag_comment, &track.id3.comment); - ADD_TAG(entry, tag_albumartist, &track.id3.albumartist); + if (has_albumartist) + { + ADD_TAG(entry, tag_albumartist, &track.id3.albumartist); + } + else + { + ADD_TAG(entry, tag_albumartist, &track.id3.artist); + } entry.data_length = offset; /* Write the header */ @@ -1706,7 +1717,14 @@ static void add_tagcache(char *path) write_item(track.id3.genre_string); write_item(track.id3.composer); write_item(track.id3.comment); - write_item(track.id3.albumartist); + if (has_albumartist) + { + write_item(track.id3.albumartist); + } + else + { + write_item(track.id3.artist); + } total_entry_count++; } -- cgit v1.2.3