SongFilter: search for album artist falls back to the artist tag

Implement Mantis ticket 0003646.
This commit is contained in:
Max Kellermann 2013-09-26 19:25:13 +02:00
parent e354c5c2a8
commit 44faf1080c
2 changed files with 22 additions and 9 deletions

1
NEWS
View File

@ -3,6 +3,7 @@ ver 0.18 (2012/??/??)
- allow tilde paths for socket
* protocol:
- new command "toggleoutput"
- search for album artist falls back to the artist tag
* innput:
- curl: enable https
- soup: plugin removed

View File

@ -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;
}