def new_file(filename): if filename[0] == '.': return Monitor.files.append(filename) path = os.sep.join([Monitor.path, filename]) parsed = Parser.parse(path) parsed['date'] = int(time.time() * 1000) PostsManager.new_post(parsed) PostsManager.save_to_file()
def monitor_updates(): PostsManager.init() while True: Monitor.update() sleep(5)
def get(self, post_id): try: return PostsManager.get_post(post_id) except Exception, e: return {'ERROR': str(e)}
def get(self): try: return PostsManager.get_all_posts() except Exception, e: return {'ERROR': str(e)}
def main(): PostsManager.init() for i in xrange(1): Monitor.update()