refactor(TwitchChannel): remove getGameById call (#3662)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Sidd 2022-04-09 05:27:04 -07:00 committed by GitHub
parent 0b9f62188c
commit c399d4dbe9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 33 deletions

View file

@ -6,6 +6,7 @@
- Minor: Adjust large stream thumbnail to 16:9 (#3655) - Minor: Adjust large stream thumbnail to 16:9 (#3655)
- Minor: Fixed being unable to load Twitch Usercards from the `/mentions` tab. (#3623) - Minor: Fixed being unable to load Twitch Usercards from the `/mentions` tab. (#3623)
- Bugfix: Fixed live notifications for usernames containing uppercase characters. (#3646) - Bugfix: Fixed live notifications for usernames containing uppercase characters. (#3646)
- Dev: Use Game Name returned by Get Streams instead of querying it from the Get Games API. (#3662)
## 2.3.5 ## 2.3.5

View file

@ -735,39 +735,8 @@ void TwitchChannel::parseLiveStatus(bool live, const HelixStream &stream)
{ {
auto status = this->streamStatus_.access(); auto status = this->streamStatus_.access();
status->viewerCount = stream.viewerCount; status->viewerCount = stream.viewerCount;
if (status->gameId != stream.gameId)
{
status->gameId = stream.gameId; status->gameId = stream.gameId;
status->game = stream.gameName;
if (!stream.gameId.isEmpty())
{
// Resolve game ID to game name
getHelix()->getGameById(
stream.gameId,
[this, weak = weakOf<Channel>(this)](const auto &game) {
ChannelPtr shared = weak.lock();
if (!shared)
{
return;
}
{
auto status = this->streamStatus_.access();
status->game = game.name;
}
this->liveStatusChanged.invoke();
},
[] {
// failure
});
}
else
{
// Game is nothing and can't be resolved by the API, force empty
status->game = "";
}
}
status->title = stream.title; status->title = stream.title;
QDateTime since = QDateTime::fromString(stream.startedAt, Qt::ISODate); QDateTime since = QDateTime::fromString(stream.startedAt, Qt::ISODate);
auto diff = since.secsTo(QDateTime::currentDateTime()); auto diff = since.secsTo(QDateTime::currentDateTime());