main.py 1005 Bytes
# -*- coding: UTF-8 -*-

import os
import pyutil
import sys
import task_manager
import time

def main():
    seconds = 10
    json_data = None
    task = None
    pyutil.log("wikilibras task manager started")
    while (task == None):
        try:
            json_data = task_manager.load_json(os.path.join(os.path.dirname(os.path.abspath('__file__')), "settings_local.json"))
            task = task_manager.task_config(json_data)
        except:
            task = None
            print("Waiting for Network to Get Projects ID's")
            time.sleep(10)

    if (json_data != None and task != None):
        pyutil.log("wikilibras task manager checking for tasks")
        while (True):
            task.run(task.data["corretor"])
            task.run(task.data["validador"])
            task.run(task.data["wikilibras"])
            print("Waiting %d seconds to check new tasks" % (seconds))
            time.sleep(seconds)

if __name__ == '__main__':
    main()