mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
parent
2b3fa06539
commit
990ac651ae
|
@ -259,6 +259,19 @@ void TwitchChannel::refreshLiveStatus()
|
|||
auto diff = since.secsTo(QDateTime::currentDateTime());
|
||||
channel->streamStatus.uptime =
|
||||
QString::number(diff / 3600) + "h " + QString::number(diff % 3600 / 60) + "m";
|
||||
|
||||
channel->streamStatus.rerun = false;
|
||||
|
||||
if (stream.HasMember("broadcast_platform")) {
|
||||
const auto &broadcastPlatformValue = stream["broadcast_platform"];
|
||||
|
||||
if (broadcastPlatformValue.IsString()) {
|
||||
const char *broadcastPlatform = stream["broadcast_platform"].GetString();
|
||||
if (strcmp(broadcastPlatform, "rerun") == 0) {
|
||||
channel->streamStatus.rerun = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
channel->setLive(true);
|
||||
|
|
|
@ -24,6 +24,7 @@ class TwitchChannel final : public Channel
|
|||
public:
|
||||
struct StreamStatus {
|
||||
bool live = false;
|
||||
bool rerun = false;
|
||||
unsigned viewerCount = 0;
|
||||
QString title;
|
||||
QString game;
|
||||
|
|
|
@ -172,14 +172,17 @@ void SplitHeader::updateChannelText()
|
|||
this->isLive = true;
|
||||
this->tooltip = "<style>.center { text-align: center; }</style>"
|
||||
"<p class = \"center\">" +
|
||||
streamStatus.title + "<br><br>" + streamStatus.game +
|
||||
"<br>"
|
||||
"Live for " +
|
||||
streamStatus.title + "<br><br>" + streamStatus.game + "<br>" +
|
||||
(streamStatus.rerun ? "Vod-casting" : "Live") + " for " +
|
||||
streamStatus.uptime + " with " +
|
||||
QString::number(streamStatus.viewerCount) +
|
||||
" viewers"
|
||||
"</p>";
|
||||
this->titleLabel->setText(channelName + " (live)");
|
||||
if (streamStatus.rerun) {
|
||||
this->titleLabel->setText(channelName + " (rerun)");
|
||||
} else {
|
||||
this->titleLabel->setText(channelName + " (live)");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue