Merge pull request #504 from kytvi2p/issue502

RSS: fix initialAnnounceHeadlines not being obeyed
This commit is contained in:
Valentin Lorentz 2013-08-15 16:38:37 -07:00
commit cee144d841

View File

@ -200,6 +200,7 @@ class RSS(callbacks.Plugin):
if normalize(headline) in oldheadlinesset: if normalize(headline) in oldheadlinesset:
newheadlines[i] = None newheadlines[i] = None
newheadlines = filter(None, newheadlines) # Removes Nones. newheadlines = filter(None, newheadlines) # Removes Nones.
number_of_headlines = len(oldheadlines)
oldheadlines.extend(newheadlines) oldheadlines.extend(newheadlines)
self.cachedHeadlines[url] = oldheadlines self.cachedHeadlines[url] = oldheadlines
if newheadlines: if newheadlines:
@ -218,7 +219,7 @@ class RSS(callbacks.Plugin):
break break
return v return v
for channel in channels: for channel in channels:
if len(oldheadlines) == 0: if number_of_headlines == 0:
channelnewheadlines = newheadlines[:self.registryValue('initialAnnounceHeadlines', channel)] channelnewheadlines = newheadlines[:self.registryValue('initialAnnounceHeadlines', channel)]
else: else:
channelnewheadlines = newheadlines[:] channelnewheadlines = newheadlines[:]