def on_newfeed(self, feed_thread, title, link): feed = self.get_feed(feed_thread) chans = None if feed.chan: chans = [feed.chan.name] if not chans: chans = self.conf.get(feed.name, {}).get("chans", []) if not chans: chans = self.taemin.chans for chan in chans: try: chan = schema.Chan.get(name=chan) except schema.Chan.DoesNotExist: self.taemin.log.warning("RSS plugin: %s is not a valid chan" % chan) continue entry = self.get_entry(feed, title, link, chan) if entry: continue self.taemin.connection.privmsg(chan.name, "[%s] %s: %s" % (feed.name, title, link)) FeedEntry.create(chan=chan, feed=feed, title=title, link=link)
def get_entry(self, feed, title, link, chan): try: return FeedEntry.get(link=link, title=title, chan=chan) except FeedEntry.DoesNotExist: return None