def main():
    prs = argparse.ArgumentParser(description='Generate the website anew.')
    prs.add_argument('-c', '--conf', type=str,
                     default="example_configuration.yml", dest='conf_path',
                     help='Path to the configuration file.')
    args = prs.parse_args()
    conf = yaml.load(open(args.conf_path, 'r').read())
    task_manager = pst.Tasker(conf)
    watcher = Watcher(task_manager)
    watcher.start()
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        watcher.stop()
    watcher.join()
Exemple #2
0
class Scanner:
    def __init__(self, path):
        self.path = path
        self.queue = Queue.PriorityQueue()
        self.watcher = Watcher(path, self.queue)
        self.walker = Walker(path, self.queue, Settings.is_rescan_forced())
        self.reader = Reader(self.queue)
        self.validator = Validator(self.queue)

    def start(self):
        self.validator.start()
        self.watcher.start()
        self.walker.start()
        self.reader.start()

    def stop(self):
        self.watcher.stop()
        self.reader.stop()

        self.validator.join()
        self.walker.join()
        self.watcher.join()
        self.reader.join()