mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2024-12-29 01:29:55 +01:00
Prevent compilation and live albums from being picked before studio albums for album cover searches based on artist + song title
This commit is contained in:
parent
ee85fb3aec
commit
ab67536d9a
@ -133,17 +133,40 @@ void AlbumCoverFetcherSearch::ProviderSearchResults(CoverProvider *provider, con
|
||||
|
||||
CoverSearchResults results_copy(results);
|
||||
for (int i = 0 ; i < results_copy.count() ; ++i) {
|
||||
|
||||
results_copy[i].provider = provider->name();
|
||||
results_copy[i].score = provider->quality();
|
||||
if (results_copy[i].artist.toLower() == request_.artist.toLower()) {
|
||||
|
||||
QString request_artist = request_.artist.toLower();
|
||||
QString request_album = request_.album.toLower();
|
||||
QString result_artist = results_copy[i].artist.toLower();
|
||||
QString result_album = results_copy[i].album.toLower();
|
||||
|
||||
if (result_artist == request_artist) {
|
||||
results_copy[i].score += 0.5;
|
||||
}
|
||||
if (results_copy[i].album.toLower() == request_.album.toLower()) {
|
||||
if (result_album == request_album) {
|
||||
results_copy[i].score += 0.5;
|
||||
}
|
||||
if (results_copy[i].artist.toLower() != request_.artist.toLower() && results_copy[i].album.toLower() != request_.album.toLower()) {
|
||||
if (result_artist != request_artist && result_album != request_album) {
|
||||
results_copy[i].score -= 1.5;
|
||||
}
|
||||
|
||||
// Decrease score if the search was based on artist and song title, and the resulting album is a compilation or live album.
|
||||
// This is done since we can't match the album titles, and we want to prevent compilation or live albums from being picked before studio albums for streams.
|
||||
if (request_album.isEmpty() && (
|
||||
result_album.contains("hits") ||
|
||||
result_album.contains("best") ||
|
||||
result_album.contains("collection") ||
|
||||
result_album.contains("classics") ||
|
||||
result_album.contains("singles") ||
|
||||
result_album.contains("bootleg") ||
|
||||
result_album.contains("live") ||
|
||||
result_album.contains("concert")
|
||||
)) {
|
||||
results_copy[i].score -= 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Add results from the current provider to our pool
|
||||
|
Loading…
Reference in New Issue
Block a user