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_);
Q_ASSERT(count_ > 0);
--count_;
qLog(Debug) << "Decrement:" << count_;
if (count_ == 0) {
emit Done();
}

View File

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