Differentiate live streams and vodcasts

Fixes #320
This commit is contained in:
Rasmus Karlsson
2018-04-08 15:14:14 +02:00
parent 2b3fa06539
commit 990ac651ae
3 changed files with 21 additions and 4 deletions
+13
View File
@@ -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);
+1
View File
@@ -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;