def need_refresh(self): if not self.update_period: return True else: age=self.age() log.chatty("age=%r, update_period=%r"%(age, self.update_period)) return age > self.update_period
def _cbRefresh(self, rss, writerlist, starttime): self.title=rss.getTitle() self.update_period=rss.get_update_period() old_seen=self.seen self.seen={} saw_old_ones=0 for item in rss.getItems(): if not old_seen.has_key(item.hash()): log.chatty('New item.') for writer in writerlist: writer.store(item) else: saw_old_ones=1 self.ack(item, starttime) if not saw_old_ones and old_seen!={}: log.critical("No overlap since last update, you may have missed some items") self.save_state()
def __init__(self, config, formatter, feed): self.formatter=formatter self.feed=feed folder=config['folder'] if config['feeds-in-folders']: name = string.strip(self.feed.name).decode('utf-8') segments = name.split(u'ยท') folder=mailfolder_join( folder, *(safefilenames.makesafe(seg.encode('utf-8')) for seg in segments) ) log.chatty('Storing to Maildir', config['maildir'], folder and 'folder '+folder or 'default folder') dir = config['maildir'] if folder is not None: dir = os.path.join(dir, '.'+folder) self.dir = dir