mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Add showLinks config variable and remove an unnecessary utils.htmlToText
This commit is contained in:
parent
5c32fc3e17
commit
4a8e60b087
@ -73,6 +73,9 @@ conf.registerChannelValue(conf.supybot.plugins.RSS, 'announce',
|
||||
AnnouncedFeeds([], """Determines which RSS feeds should be announced in the
|
||||
channel; valid input is a list of strings (either registered RSS feeds or
|
||||
RSS feed URLs) separated by spaces."""))
|
||||
conf.registerGlobalValue(conf.supybot.plugins.RSS, 'showLinks',
|
||||
registry.Boolean(False, """Determines whether the bot will list the link
|
||||
along with the title of the feed."""))
|
||||
conf.registerGlobalValue(conf.supybot.plugins.RSS, 'waitPeriod',
|
||||
registry.PositiveInteger(1800, """Indicates how many seconds the bot will
|
||||
wait between retrieving RSS feeds; requests made within this period will
|
||||
@ -226,8 +229,16 @@ class RSS(callbacks.Privmsg):
|
||||
self.releaseLock(url)
|
||||
|
||||
def getHeadlines(self, feed):
|
||||
return [utils.htmlToText(d['title'].strip()) for d in feed['items'] if
|
||||
'title' in d]
|
||||
headlines = []
|
||||
showLinks = self.registryValue('showLinks')
|
||||
for d in feed['items']:
|
||||
if 'title' in d:
|
||||
title = utils.htmlToText(d['title']).strip()
|
||||
if showLinks:
|
||||
headlines.append('%s <%s>' % (title, d['link']))
|
||||
else:
|
||||
headlines.append('%s' % title)
|
||||
return headlines
|
||||
|
||||
def _validFeedName(self, name):
|
||||
if not registry.isValidRegistryName(name):
|
||||
@ -350,7 +361,6 @@ class RSS(callbacks.Privmsg):
|
||||
except ValueError:
|
||||
raise callbacks.ArgumentError
|
||||
headlines = headlines[:n]
|
||||
headlines = imap(utils.htmlToText, headlines)
|
||||
sep = self.registryValue('headlineSeparator', channel)
|
||||
irc.reply(sep.join(headlines))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user