Increase lyrics score if lyrics text > 60
This commit is contained in:
parent
7f442cff3b
commit
443be1c2c8
|
@ -113,6 +113,7 @@ void AuddLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 i
|
|||
result.score = 0.0;
|
||||
if (result.artist.toLower() == artist.toLower()) result.score += 1.0;
|
||||
if (result.title.toLower() == title.toLower()) result.score += 1.0;
|
||||
if (result.lyrics.length() > LyricsFetcher::kGoodLyricsLength) result.score += 1.0;
|
||||
//qLog(Debug) << "AudDLyrics:" << result.artist << result.title << result.lyrics.length();
|
||||
|
||||
results << result;
|
||||
|
|
|
@ -112,6 +112,7 @@ void ChartLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64
|
|||
result.score = 0.0;
|
||||
if (result.artist.toLower() == artist.toLower()) result.score += 1.0;
|
||||
if (result.title.toLower() == title.toLower()) result.score += 1.0;
|
||||
if (result.lyrics.length() > LyricsFetcher::kGoodLyricsLength) result.score += 1.0;
|
||||
if (result.artist.toLower() == artist.toLower() || result.title.toLower() == title.toLower()) {
|
||||
results << result;
|
||||
}
|
||||
|
|
|
@ -119,6 +119,12 @@ void LoloLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 i
|
|||
else if (type == QXmlStreamReader::EndElement) {
|
||||
if (name == "result") {
|
||||
if (!result.lyrics.isEmpty()) {
|
||||
if (result.artist.toLower() == artist.toLower())
|
||||
result.score += 1.0;
|
||||
if (result.title.toLower() == title.toLower())
|
||||
result.score += 1.0;
|
||||
if (result.lyrics.length() > LyricsFetcher::kGoodLyricsLength)
|
||||
result.score += 1.0;
|
||||
results << result;
|
||||
}
|
||||
result = LyricsSearchResult();
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "lyricsfetchersearch.h"
|
||||
|
||||
const int LyricsFetcher::kMaxConcurrentRequests = 5;
|
||||
const int LyricsFetcher::kGoodLyricsLength = 60;
|
||||
|
||||
LyricsFetcher::LyricsFetcher(LyricsProviders *lyrics_providers, QObject *parent)
|
||||
: QObject(parent),
|
||||
|
|
|
@ -65,6 +65,7 @@ class LyricsFetcher : public QObject {
|
|||
virtual ~LyricsFetcher() {}
|
||||
|
||||
static const int kMaxConcurrentRequests;
|
||||
static const int kGoodLyricsLength;
|
||||
|
||||
quint64 Search(const QString &artist, const QString &album, const QString &title);
|
||||
void Clear();
|
||||
|
|
|
@ -87,6 +87,9 @@ void OVHLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id
|
|||
|
||||
LyricsSearchResult result;
|
||||
result.lyrics = json_obj["lyrics"].toString();
|
||||
if (result.lyrics.length() > LyricsFetcher::kGoodLyricsLength)
|
||||
result.score += 1.0;
|
||||
|
||||
qLog(Debug) << "OVHLyrics: Got lyrics for" << artist << title;
|
||||
emit SearchFinished(id, LyricsSearchResults() << result);
|
||||
|
||||
|
|
Loading…
Reference in New Issue