mirror of https://github.com/Mikaela/Limnoria.git
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
|
AnnouncedFeeds([], """Determines which RSS feeds should be announced in the
|
||||||
channel; valid input is a list of strings (either registered RSS feeds or
|
channel; valid input is a list of strings (either registered RSS feeds or
|
||||||
RSS feed URLs) separated by spaces."""))
|
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',
|
conf.registerGlobalValue(conf.supybot.plugins.RSS, 'waitPeriod',
|
||||||
registry.PositiveInteger(1800, """Indicates how many seconds the bot will
|
registry.PositiveInteger(1800, """Indicates how many seconds the bot will
|
||||||
wait between retrieving RSS feeds; requests made within this period will
|
wait between retrieving RSS feeds; requests made within this period will
|
||||||
|
@ -226,8 +229,16 @@ class RSS(callbacks.Privmsg):
|
||||||
self.releaseLock(url)
|
self.releaseLock(url)
|
||||||
|
|
||||||
def getHeadlines(self, feed):
|
def getHeadlines(self, feed):
|
||||||
return [utils.htmlToText(d['title'].strip()) for d in feed['items'] if
|
headlines = []
|
||||||
'title' in d]
|
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):
|
def _validFeedName(self, name):
|
||||||
if not registry.isValidRegistryName(name):
|
if not registry.isValidRegistryName(name):
|
||||||
|
@ -350,7 +361,6 @@ class RSS(callbacks.Privmsg):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise callbacks.ArgumentError
|
raise callbacks.ArgumentError
|
||||||
headlines = headlines[:n]
|
headlines = headlines[:n]
|
||||||
headlines = imap(utils.htmlToText, headlines)
|
|
||||||
sep = self.registryValue('headlineSeparator', channel)
|
sep = self.registryValue('headlineSeparator', channel)
|
||||||
irc.reply(sep.join(headlines))
|
irc.reply(sep.join(headlines))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue