示例#1
0
文件: fetch.py 项目: raamdev/toursst
 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
示例#2
0
文件: fetch.py 项目: raamdev/toursst
    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()
示例#3
0
            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