From 53448e463383eca5633dc1d87e2004cae5dceaae Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 22 Oct 2018 10:52:42 +0200 Subject: [PATCH] tag/Fallback: add tag fallbacks for AlbumArtistSort, ArtistSort Just like AlbumArtist falls back to Artist, AlbumArtistSort should fall back tom AlbumArtist, ArtistSort and finally Artist. Closes #355 --- NEWS | 2 ++ src/tag/Fallback.hxx | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 69adaf45e..9507057e7 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.20.22 (not yet released) +* protocol + - add tag fallbacks for AlbumArtistSort, ArtistSort * storage - curl: URL-encode paths * Android diff --git a/src/tag/Fallback.hxx b/src/tag/Fallback.hxx index 5c75e8bee..08e4dc80a 100644 --- a/src/tag/Fallback.hxx +++ b/src/tag/Fallback.hxx @@ -26,8 +26,18 @@ template bool ApplyTagFallback(TagType type, F &&f) noexcept { - if (type == TAG_ALBUM_ARTIST) - /* fall back to "Artist" if no "AlbumArtist" was found */ + if (type == TAG_ALBUM_ARTIST_SORT) { + /* fall back to "AlbumArtist", "ArtistSort" and + "Artist" if no "AlbumArtistSort" was found */ + if (f(TAG_ALBUM_ARTIST)) + return true; + + return ApplyTagFallback(TAG_ARTIST_SORT, std::forward(f)); + } + + if (type == TAG_ALBUM_ARTIST || type == TAG_ARTIST_SORT) + /* fall back to "Artist" if no + "AlbumArtist"/"ArtistSort" was found */ return f(TAG_ARTIST); return false;