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

Commit

Permalink
fixed notifications appear multiple times [resolves #1]
Browse files Browse the repository at this point in the history
  • Loading branch information
Rolandas Barysas committed Mar 18, 2015
1 parent 6bf1bfa commit 39f62d8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,18 @@ def refresh_streams(self):
# Re-enable "Check now" button
GLib.idle_add(self.enable_menu)

# Update global livestreams list and create list of new streams (for notifications)
self.notify_list = [x for x in self.live_streams if x not in self.LIVE_STREAMS]
# Check which streams were not live before, create separate list for
# notifications and update main livestreams list.
# We check live streams by URL, because sometimes Twitch API does not show
# stream status, which makes notifications appear even if stream has been
# live before.
self.notify_list = list(self.live_streams)
for x in self.LIVE_STREAMS:
for y in self.live_streams:
if x["url"] == y["url"]:
self.notify_list[:] = [d for d in self.notify_list if d.get('url') != y["url"]]
break

self.LIVE_STREAMS = self.live_streams

# Push notifications of new streams
Expand Down

0 comments on commit 39f62d8

Please sign in to comment.