@@ -41,7 +41,7 @@
|
||||
|
||||
const char *LoloLyricsProvider::kUrlSearch = "http://api.lololyrics.com/0.5/getLyric";
|
||||
|
||||
LoloLyricsProvider::LoloLyricsProvider(QObject *parent) : LyricsProvider("LoloLyrics", parent), network_(new NetworkAccessManager(this)) {}
|
||||
LoloLyricsProvider::LoloLyricsProvider(QObject *parent) : LyricsProvider("LoloLyrics", true, false, parent), network_(new NetworkAccessManager(this)) {}
|
||||
|
||||
bool LoloLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
||||
|
||||
@@ -80,7 +80,8 @@ void LoloLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 i
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
failure_reason = QString("%1 (%2)").arg(reply->errorString()).arg(reply->error());
|
||||
if (reply->error() < 200) {
|
||||
Error(id, failure_reason);
|
||||
Error(failure_reason);
|
||||
emit SearchFinished(id, LyricsSearchResults());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -119,12 +120,6 @@ 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();
|
||||
@@ -140,10 +135,9 @@ void LoloLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 i
|
||||
|
||||
}
|
||||
|
||||
void LoloLyricsProvider::Error(const quint64 id, const QString &error, const QVariant &debug) {
|
||||
void LoloLyricsProvider::Error(const QString &error, const QVariant &debug) {
|
||||
|
||||
qLog(Error) << "LoloLyrics:" << error;
|
||||
if (debug.isValid()) qLog(Debug) << debug;
|
||||
emit SearchFinished(id, LyricsSearchResults());
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user