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());
|
auto diff = since.secsTo(QDateTime::currentDateTime());
|
||||||
channel->streamStatus.uptime =
|
channel->streamStatus.uptime =
|
||||||
QString::number(diff / 3600) + "h " + QString::number(diff % 3600 / 60) + "m";
|
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);
|
channel->setLive(true);
|
||||||
|
|
|
@ -24,6 +24,7 @@ class TwitchChannel final : public Channel
|
||||||
public:
|
public:
|
||||||
struct StreamStatus {
|
struct StreamStatus {
|
||||||
bool live = false;
|
bool live = false;
|
||||||
|
bool rerun = false;
|
||||||
unsigned viewerCount = 0;
|
unsigned viewerCount = 0;
|
||||||
QString title;
|
QString title;
|
||||||
QString game;
|
QString game;
|
||||||
|
|
|
@ -172,14 +172,17 @@ void SplitHeader::updateChannelText()
|
||||||
this->isLive = true;
|
this->isLive = true;
|
||||||
this->tooltip = "<style>.center { text-align: center; }</style>"
|
this->tooltip = "<style>.center { text-align: center; }</style>"
|
||||||
"<p class = \"center\">" +
|
"<p class = \"center\">" +
|
||||||
streamStatus.title + "<br><br>" + streamStatus.game +
|
streamStatus.title + "<br><br>" + streamStatus.game + "<br>" +
|
||||||
"<br>"
|
(streamStatus.rerun ? "Vod-casting" : "Live") + " for " +
|
||||||
"Live for " +
|
|
||||||
streamStatus.uptime + " with " +
|
streamStatus.uptime + " with " +
|
||||||
QString::number(streamStatus.viewerCount) +
|
QString::number(streamStatus.viewerCount) +
|
||||||
" viewers"
|
" viewers"
|
||||||
"</p>";
|
"</p>";
|
||||||
|
if (streamStatus.rerun) {
|
||||||
|
this->titleLabel->setText(channelName + " (rerun)");
|
||||||
|
} else {
|
||||||
this->titleLabel->setText(channelName + " (live)");
|
this->titleLabel->setText(channelName + " (live)");
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue