From c399d4dbe9bb22cdd6c15702d2c92e3a62f241f8 Mon Sep 17 00:00:00 2001 From: Sidd Date: Sat, 9 Apr 2022 05:27:04 -0700 Subject: [PATCH] refactor(TwitchChannel): remove getGameById call (#3662) Co-authored-by: Rasmus Karlsson --- CHANGELOG.md | 1 + src/providers/twitch/TwitchChannel.cpp | 35 ++------------------------ 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35795a7c8..4ed0f68fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Minor: Adjust large stream thumbnail to 16:9 (#3655) - Minor: Fixed being unable to load Twitch Usercards from the `/mentions` tab. (#3623) - 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 diff --git a/src/providers/twitch/TwitchChannel.cpp b/src/providers/twitch/TwitchChannel.cpp index 49e721be9..f88711545 100644 --- a/src/providers/twitch/TwitchChannel.cpp +++ b/src/providers/twitch/TwitchChannel.cpp @@ -735,39 +735,8 @@ void TwitchChannel::parseLiveStatus(bool live, const HelixStream &stream) { auto status = this->streamStatus_.access(); status->viewerCount = stream.viewerCount; - if (status->gameId != stream.gameId) - { - status->gameId = stream.gameId; - - if (!stream.gameId.isEmpty()) - { - // Resolve game ID to game name - getHelix()->getGameById( - stream.gameId, - [this, weak = weakOf(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->gameId = stream.gameId; + status->game = stream.gameName; status->title = stream.title; QDateTime since = QDateTime::fromString(stream.startedAt, Qt::ISODate); auto diff = since.secsTo(QDateTime::currentDateTime());