Cope with empty biography responses.

This commit is contained in:
John Maguire 2016-06-28 18:21:42 +01:00
parent a9ba0f3bf2
commit 7750d5015e
2 changed files with 14 additions and 13 deletions

View File

@ -29,7 +29,6 @@ void CountdownLatch::CountDown() {
QMutexLocker l(&mutex_); QMutexLocker l(&mutex_);
Q_ASSERT(count_ > 0); Q_ASSERT(count_ > 0);
--count_; --count_;
qLog(Debug) << "Decrement:" << count_;
if (count_ == 0) { if (count_ == 0) {
emit Done(); emit Done();
} }

View File

@ -72,20 +72,22 @@ void ArtistBiography::FetchInfo(int id, const Song& metadata) {
QString body = response["articleBody"].toString(); QString body = response["articleBody"].toString();
QString url = response["url"].toString(); QString url = response["url"].toString();
CollapsibleInfoPane::Data data; if (!body.isEmpty()) {
data.id_ = url; CollapsibleInfoPane::Data data;
data.title_ = tr("Biography"); data.id_ = url;
data.type_ = CollapsibleInfoPane::Data::Type_Biography; data.title_ = tr("Biography");
data.type_ = CollapsibleInfoPane::Data::Type_Biography;
QString text; QString text;
text += text += "<p><a href=\"" + url + "\">" + tr("Open in your browser") +
"<p><a href=\"" + url + "\">" + tr("Open in your browser") + "</a></p>"; "</a></p>";
text += body; text += body;
SongInfoTextView* editor = new SongInfoTextView; SongInfoTextView* editor = new SongInfoTextView;
editor->SetHtml(text); editor->SetHtml(text);
data.contents_ = editor; data.contents_ = editor;
emit InfoReady(id, data); emit InfoReady(id, data);
}
if (url.contains("wikipedia.org")) { if (url.contains("wikipedia.org")) {
FetchWikipediaImages(id, url); FetchWikipediaImages(id, url);