From 77d3b9b5e59c0f10a0b43e7946a4cb9f41811e5e Mon Sep 17 00:00:00 2001 From: Twentysix Date: Sun, 3 Dec 2017 00:53:56 +0100 Subject: [PATCH] [Streams] Match Twitch streams by ID if available (#1134) Fixes #777 --- cogs/streams.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cogs/streams.py b/cogs/streams.py index b0e64a576..6f8116191 100644 --- a/cogs/streams.py +++ b/cogs/streams.py @@ -524,9 +524,13 @@ class Streams: def enable_or_disable_if_active(self, streams, stream, channel, _id=None): """Returns True if enabled or False if disabled""" for i, s in enumerate(streams): - if s["NAME"] != stream: - continue - + stream_id = s.get("ID") + if stream_id and _id: # ID is available, matching by ID is + if stream_id != _id: # preferable + continue + else: # ID unavailable, matching by name + if s["NAME"] != stream: + continue if channel.id in s["CHANNELS"]: streams[i]["CHANNELS"].remove(channel.id) if not s["CHANNELS"]: