From a576033497b3fd53ac9e6201899f54631762fbb9 Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Thu, 7 Apr 2011 19:53:55 +0200 Subject: [PATCH] Rework album_artist/album_artist_sort handling artist_sort tends to be more and more widespread, so try to reuse artist_sort if possible instead of deriving album_artist_sort from album_artist unconditionally. --- src/filescanner.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/filescanner.c b/src/filescanner.c index ab8eefff..b24eb3a9 100644 --- a/src/filescanner.c +++ b/src/filescanner.c @@ -259,20 +259,27 @@ fixup_tags(struct media_file_info *mfi) if (!mfi->title) mfi->title = strdup(mfi->fname); - /* If we don't have an album_artist, set it to artist */ - if (!mfi->album_artist) - { - if (mfi->compilation) - mfi->album_artist = strdup(""); - else - mfi->album_artist = strdup(mfi->artist); - } - /* Ensure sort tags are filled and normalized */ normalize_fixup_tag(&mfi->artist_sort, mfi->artist); normalize_fixup_tag(&mfi->album_sort, mfi->album); normalize_fixup_tag(&mfi->title_sort, mfi->title); - normalize_fixup_tag(&mfi->album_artist_sort, mfi->album_artist); + + /* If we don't have an album_artist, set it to artist */ + if (!mfi->album_artist) + { + if (mfi->compilation) + { + mfi->album_artist = strdup(""); + mfi->album_artist_sort = strdup(""); + } + else + mfi->album_artist = strdup(mfi->artist); + } + + if (!mfi->album_artist_sort && (strcmp(mfi->album_artist, mfi->artist) == 0)) + mfi->album_artist_sort = strdup(mfi->artist_sort); + else + normalize_fixup_tag(&mfi->album_artist_sort, mfi->album_artist); /* Composer is not one of our mandatory tags, so take extra care */ if (mfi->composer_sort || mfi->composer)