Don't show non-existant channels as live

This commit is contained in:
Rasmus Karlsson 2017-11-04 12:42:37 +01:00
parent bdd5e4aae6
commit e1a31785ef

View file

@ -97,7 +97,8 @@ void ChatWidgetHeader::updateChannelText()
"<br>"
"Live for " +
twitchChannel->streamUptime + " with " +
twitchChannel->streamViewerCount + " viewers"
twitchChannel->streamViewerCount +
" viewers"
"</p>");
} else {
this->channelNameLabel.setText(QString::fromStdString(channelName));
@ -213,6 +214,12 @@ void ChatWidgetHeader::checkLive()
auto id = QString::fromStdString(channel->roomID);
if (id.isEmpty()) {
channel->isLive = false;
this->updateChannelText();
return;
}
util::twitch::get("https://api.twitch.tv/kraken/streams/" + id, this, [=](QJsonObject obj) {
if (obj.value("stream").isNull()) {
channel->isLive = false;