Esempio n. 1
0
 def __init__(self, file):
     self.name = ''
     self.version = ''
     self.author = ''
     self.module_name = ''
     
     config = ConfigObj(file, encoding='utf-8')
     if config is None:
         return
         
     if check_section(config, 'Regestration') is False:
         return
         
     self.name = check_setting_str(config, 'Regestration', 'name', '')
     self.module_name = check_setting_str(config, 'Regestration', 'module_name', '')
Esempio n. 2
0
def initialise():
    with INIT_LOCK:
        global CONFIG_VERSION,HTTP_PORT,HTTP_HOST,HTTP_ROOT,CACHE_DIR,LOG_DIR,FULL_PATH,PROG_DIR,CONFIG_FILE,CFG,INIT_LOCK,VERBOSE,__INITIALISED__

        if __INITIALISED__:
            return False

        check_section(CFG,'General')

        try:
            HTTP_PORT = check_setting_int(CFG, 'General', 'http_port', 8091)
        except:
            HTTP_PORT = 8091

        if HTTP_PORT < 21 or HTTP_PORT > 65535:
            HTTP_PORT = 8091

        HTTP_HOST = check_setting_str(CFG, 'General', 'http_host', '0.0.0.0')
        HTTP_ROOT = check_setting_str(CFG, 'General', 'http_root', '/')
        CONFIG_VERSION = check_setting_str(CFG, 'General', 'config_version', '1')
        CACHE_DIR = check_setting_str(CFG, 'General', 'cache_dir', '')
        VERBOSE = check_setting_str(CFG, 'General', 'log_level', 1)
        LOG_DIR = check_setting_str(CFG, 'General', 'log_dir', '')

        if not LOG_DIR:
            LOG_DIR = os.path.join(PROG_DIR, 'logs')

        if not os.path.exists(LOG_DIR):
            os.makedirs(LOG_DIR)
            
        PLUGIN_MANAGER.locate_plugins(os.path.join(PROG_DIR, 'extentions'))
        PLUGIN_MANAGER.register_plugins()

        config_write()

        __INITIALISED__ = True
        return True