mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 10:34:19 +01:00
Fixed bug in announcements.
This commit is contained in:
parent
880bf8544c
commit
24c25436be
@ -159,14 +159,11 @@ class RSS(callbacks.Privmsg):
|
|||||||
oldheadlines = []
|
oldheadlines = []
|
||||||
newresults = self.getFeed(url)
|
newresults = self.getFeed(url)
|
||||||
newheadlines = self.getHeadlines(newresults)
|
newheadlines = self.getHeadlines(newresults)
|
||||||
def headlineEq(h1, h2):
|
def canonicalize(headline):
|
||||||
return h1.lower().split() == h2.lower().split()
|
return tuple(headline.lower().split())
|
||||||
for (i, oldheadline) in enumerate(oldheadlines):
|
oldheadlines = sets.Set(map(canonicalize, oldheadlines))
|
||||||
try:
|
for (i, headline) in enumerate(newheadlines):
|
||||||
newheadline = newheadlines[i]
|
if canonicalize(headline) in oldheadlines:
|
||||||
except IndexError:
|
|
||||||
break
|
|
||||||
if headlineEq(oldheadline, newheadline):
|
|
||||||
newheadlines[i] = None
|
newheadlines[i] = None
|
||||||
newheadlines = filter(None, newheadlines) # Removes Nones.
|
newheadlines = filter(None, newheadlines) # Removes Nones.
|
||||||
if newheadlines:
|
if newheadlines:
|
||||||
|
Loading…
Reference in New Issue
Block a user