aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-09-26 19:25:13 +0200
committerMax Kellermann <max@duempel.org>2013-09-26 19:25:13 +0200
commit44faf1080c944b4b9f579e34346c0b0d56de7da2 (patch)
tree7a54aac94824f3982e201ed26b4ea2124beb7329 /src
parente354c5c2a856b442e8f141904fc203018d6bb4c1 (diff)
downloadmpd-44faf1080c944b4b9f579e34346c0b0d56de7da2.tar.gz
mpd-44faf1080c944b4b9f579e34346c0b0d56de7da2.tar.xz
mpd-44faf1080c944b4b9f579e34346c0b0d56de7da2.zip
SongFilter: search for album artist falls back to the artist tag
Implement Mantis ticket 0003646.
Diffstat (limited to 'src')
-rw-r--r--src/SongFilter.cxx30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/SongFilter.cxx b/src/SongFilter.cxx
index c0404406d..4b8ae20ba 100644
--- a/src/SongFilter.cxx
+++ b/src/SongFilter.cxx
@@ -94,15 +94,27 @@ SongFilter::Item::Match(const Tag &_tag) const
return true;
}
- /** If the search critieron was not visited during the sweep
- * through the song's tag, it means this field is absent from
- * the tag or empty. Thus, if the searched string is also
- * empty (first char is a \0), then it's a match as well and
- * we should return true.
- */
- if (*value == 0 && tag < TAG_NUM_OF_ITEM_TYPES &&
- !visited_types[tag])
- return true;
+ if (tag < TAG_NUM_OF_ITEM_TYPES && !visited_types[tag]) {
+ /* If the search critieron was not visited during the
+ sweep through the song's tag, it means this field
+ is absent from the tag or empty. Thus, if the
+ searched string is also empty (first char is a \0),
+ then it's a match as well and we should return
+ true. */
+ if (*value == 0)
+ return true;
+
+ if (tag == TAG_ALBUM_ARTIST && visited_types[TAG_ARTIST]) {
+ /* if we're looking for "album artist", but
+ only "artist" exists, use that */
+ for (unsigned i = 0; i < _tag.num_items; i++) {
+ const TagItem &item = *_tag.items[i];
+ if (item.type == TAG_ARTIST &&
+ StringMatch(item.value))
+ return true;
+ }
+ }
+ }
return false;
}