Only consider album artists for artist covers. fixes #398
This commit is contained in:
@@ -429,16 +429,22 @@ namespace Cover
|
|||||||
std::set<std::filesystem::path> parentPaths;
|
std::set<std::filesystem::path> parentPaths;
|
||||||
{
|
{
|
||||||
Session& session{ _db.getTLSSession() };
|
Session& session{ _db.getTLSSession() };
|
||||||
|
|
||||||
|
Track::FindParameters params;
|
||||||
|
params.setArtist(artistId, { TrackArtistLinkType::ReleaseArtist });
|
||||||
|
|
||||||
auto transaction{ session.createReadTransaction() };
|
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());
|
parentPaths.insert(track->getPath().parent_path());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parentPaths.size() == 1)
|
if (parentPaths.size() == 1)
|
||||||
|
{
|
||||||
artistImage = getFromDirectory(parentPaths.begin()->parent_path(), width, _artistFileNames, false);
|
artistImage = getFromDirectory(parentPaths.begin()->parent_path(), width, _artistFileNames, false);
|
||||||
|
}
|
||||||
else if (parentPaths.size() > 1)
|
else if (parentPaths.size() > 1)
|
||||||
{
|
{
|
||||||
const std::filesystem::path longestCommonPath{ PathUtils::getLongestCommonPath(std::cbegin(parentPaths), std::cend(parentPaths)) };
|
const std::filesystem::path longestCommonPath{ PathUtils::getLongestCommonPath(std::cbegin(parentPaths), std::cend(parentPaths)) };
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ TEST(Path, getLongestCommonPathIterator)
|
|||||||
{{"/foo", "/bar"}, "/"},
|
{{"/foo", "/bar"}, "/"},
|
||||||
{{"/foo/bar/file1.txt", "/foo/bar/file2.txt"}, "/foo/bar"},
|
{{"/foo/bar/file1.txt", "/foo/bar/file2.txt"}, "/foo/bar"},
|
||||||
{{"/foo", "/foo/"}, "/foo"},
|
{{"/foo", "/foo/"}, "/foo"},
|
||||||
|
{{"/foo", "/foo"}, "/foo"},
|
||||||
{{"/foo/", "/foo/"}, "/foo/"},
|
{{"/foo/", "/foo/"}, "/foo/"},
|
||||||
{{"/foo/", "/foo/", "/bar"}, "/"},
|
{{"/foo/", "/foo/", "/bar"}, "/"},
|
||||||
{{"/foo/", "/foo/", "/foo/bar"}, "/foo"},
|
{{"/foo/", "/foo/", "/foo/bar"}, "/foo"},
|
||||||
|
|||||||
Reference in New Issue
Block a user