From b5a9bffee1ce0f51fa9637e08dbbe7bc8b32af05 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 6 Jan 2014 00:24:51 +0100 Subject: ircbot: fixed everythink --- ircbot/rssbot.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ircbot/rssbot.py b/ircbot/rssbot.py index 5fd30877..b73b4e41 100755 --- a/ircbot/rssbot.py +++ b/ircbot/rssbot.py @@ -31,6 +31,12 @@ class RssBot(irc.bot.SingleServerIRCBot): self.disconnect() def updateloop(self): + try: + self.feed = feedparser.parse(self.url) + except: + print(self.name + ': rss timeout occured') + for entry in self.feed.entries: + self.oldnews.append(entry.link) while self.loop: try: self.feed = feedparser.parse(self.url) @@ -46,15 +52,11 @@ class RssBot(irc.bot.SingleServerIRCBot): self.lastpull = datetime.now() sleep(self.to) - def sendall(self): - while len(self.sendqueue) > 0: - sleep(1) - self.send(self.sendqueue.pop()) def send(self, string): urls = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', string) for url in urls: - shorturl = subprocess.check_output(["curl", "-F", "uri=" + url, "http://127.0.0.1:1337"]) + shorturl = subprocess.check_output(["curl", "-F", "uri=" + url, "http://wall:1337"]).decode() string = string.replace(url, shorturl) if self.connection.connected: for line in string.split('\n'): -- cgit v1.2.3