Don't break if game is None

This commit is contained in:
Ivan Habunek 2020-05-29 13:55:54 +02:00
parent 717f634dda
commit 2cf66c022c
No known key found for this signature in database
GPG Key ID: CDBD63C43A30BB95

View File

@ -61,13 +61,16 @@ def print_video(video):
published_at = video["publishedAt"].replace("T", " @ ").replace("Z", "")
length = utils.format_duration(video["lengthSeconds"])
channel = video["creator"]["channel"]["displayName"]
game = video["game"]["name"]
playing = (
" playing <blue>{}</blue>".format(video["game"]["name"])
if video["game"] else ""
)
# Can't find URL in video object, strange
url = "https://twitch.tv/{}".format(video["id"])
print_out("\n<b>{}</b>".format(video["id"]))
print_out("<green>{}</green>".format(video["title"]))
print_out("<blue>{}</blue> playing <blue>{}</blue>".format(channel, game))
print_out("<blue>{}</blue> {}".format(channel, playing))
print_out("Published <blue>{}</blue> Length: <blue>{}</blue> ".format(published_at, length))
print_out("<i>{}</i>".format(url))