Fix print_clip when game is not set

This commit is contained in:
Ivan Habunek 2020-11-10 10:44:18 +01:00
parent 69de08e2ba
commit 678bf11a8a
No known key found for this signature in database
GPG Key ID: CDBD63C43A30BB95

View File

@ -84,13 +84,15 @@ def print_video(video):
def print_clip(clip):
published_at = clip["createdAt"].replace("T", " @ ").replace("Z", "")
length = utils.format_duration(clip["durationSeconds"])
channel = clip["broadcaster"]["channel"]["displayName"]
playing = (
"playing <blue>{}</blue>".format(clip["game"]["name"])
if clip["game"] else ""
)
print_out("\n<b>{}</b>".format(clip["slug"]))
print_out("<green>{}</green>".format(clip["title"]))
print_out("<blue>{}</blue> playing <blue>{}</blue>".format(
clip["broadcaster"]["channel"]["displayName"],
clip["game"]["name"]
))
print_out("<blue>{}</blue> {}".format(channel, playing))
print_out(
"Published <blue>{}</blue>"
" Length: <blue>{}</blue>"