Skip to content
This repository was archived by the owner on Mar 3, 2018. It is now read-only.

Commit 39f62d8

Browse files
author
Rolandas Barysas
committed
fixed notifications appear multiple times [resolves #1]
1 parent 6bf1bfa commit 39f62d8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

run.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,18 @@ def refresh_streams(self):
241241
# Re-enable "Check now" button
242242
GLib.idle_add(self.enable_menu)
243243

244-
# Update global livestreams list and create list of new streams (for notifications)
245-
self.notify_list = [x for x in self.live_streams if x not in self.LIVE_STREAMS]
244+
# Check which streams were not live before, create separate list for
245+
# notifications and update main livestreams list.
246+
# We check live streams by URL, because sometimes Twitch API does not show
247+
# stream status, which makes notifications appear even if stream has been
248+
# live before.
249+
self.notify_list = list(self.live_streams)
250+
for x in self.LIVE_STREAMS:
251+
for y in self.live_streams:
252+
if x["url"] == y["url"]:
253+
self.notify_list[:] = [d for d in self.notify_list if d.get('url') != y["url"]]
254+
break
255+
246256
self.LIVE_STREAMS = self.live_streams
247257

248258
# Push notifications of new streams

0 commit comments

Comments
 (0)