From 91b9602e1203676e7506b118a752f09d2145b2a0 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sun, 20 Dec 2020 07:09:12 +0100 Subject: [PATCH] Dont use empty lyrics from API --- src/lyrics/auddlyricsprovider.cpp | 3 +-- src/lyrics/ovhlyricsprovider.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/lyrics/auddlyricsprovider.cpp b/src/lyrics/auddlyricsprovider.cpp index 6efa9a265..70f636eba 100644 --- a/src/lyrics/auddlyricsprovider.cpp +++ b/src/lyrics/auddlyricsprovider.cpp @@ -128,8 +128,7 @@ void AuddLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 i result.title = json_obj["title"].toString(); if (result.artist.toLower() != artist.toLower() && result.title.toLower() != title.toLower()) continue; result.lyrics = json_obj["lyrics"].toString(); - if (result.lyrics.length() > kMaxLength) continue; - if (result.lyrics == "error") continue; + if (result.lyrics.isEmpty() || result.lyrics.length() > kMaxLength || result.lyrics == "error") continue; //qLog(Debug) << "AudDLyrics:" << result.artist << result.title << result.lyrics.length(); diff --git a/src/lyrics/ovhlyricsprovider.cpp b/src/lyrics/ovhlyricsprovider.cpp index bd0c9abf0..ed5021ac1 100644 --- a/src/lyrics/ovhlyricsprovider.cpp +++ b/src/lyrics/ovhlyricsprovider.cpp @@ -102,9 +102,14 @@ void OVHLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id LyricsSearchResult result; result.lyrics = json_obj["lyrics"].toString(); - qLog(Debug) << "OVHLyrics: Got lyrics for" << artist << title; - - emit SearchFinished(id, LyricsSearchResults() << result); + if (result.lyrics.isEmpty()) { + qLog(Debug) << "OVHLyrics: No lyrics for" << artist << title; + emit SearchFinished(id, LyricsSearchResults()); + } + else { + qLog(Debug) << "OVHLyrics: Got lyrics for" << artist << title; + emit SearchFinished(id, LyricsSearchResults() << result); + } }