Only consider album artists for artist covers. fixes #398

This commit is contained in:
emeric
2024-01-07 15:08:32 +01:00
parent fa3638ef46
commit 5882e61886
2 changed files with 8 additions and 1 deletions
@@ -429,16 +429,22 @@ namespace Cover
std::set<std::filesystem::path> parentPaths;
{
Session& session{ _db.getTLSSession() };
Track::FindParameters params;
params.setArtist(artistId, { TrackArtistLinkType::ReleaseArtist });
auto transaction{ session.createReadTransaction() };
Track::find(session, Track::FindParameters{}.setArtist(artistId), [&](const Track::pointer& track)
Track::find(session, params, [&](const Track::pointer& track)
{
parentPaths.insert(track->getPath().parent_path());
});
}
if (parentPaths.size() == 1)
{
artistImage = getFromDirectory(parentPaths.begin()->parent_path(), width, _artistFileNames, false);
}
else if (parentPaths.size() > 1)
{
const std::filesystem::path longestCommonPath{ PathUtils::getLongestCommonPath(std::cbegin(parentPaths), std::cend(parentPaths)) };
+1
View File
@@ -66,6 +66,7 @@ TEST(Path, getLongestCommonPathIterator)
{{"/foo", "/bar"}, "/"},
{{"/foo/bar/file1.txt", "/foo/bar/file2.txt"}, "/foo/bar"},
{{"/foo", "/foo/"}, "/foo"},
{{"/foo", "/foo"}, "/foo"},
{{"/foo/", "/foo/"}, "/foo/"},
{{"/foo/", "/foo/", "/bar"}, "/"},
{{"/foo/", "/foo/", "/foo/bar"}, "/foo"},