def _load(self, account): self.account = account # Create home directory utils.make_dir('') self.configfile = utils.get_root_filename('config.json') # Create user directory userfolder = "%s.%s" % (account['username'], account['api']) utils.make_dir(userfolder) self.msg.info( self.name, 'Trackma v{0} - using account {1}({2}).'.format( utils.VERSION, account['username'], account['api'])) self.msg.info(self.name, 'Reading config files...') try: self.config = utils.parse_config(self.configfile, utils.config_defaults) except IOError: raise utils.EngineFatal("Couldn't open config file.") # Load hook file if os.path.exists(utils.get_root_filename('hook.py')): import sys sys.path[0:0] = [utils.get_root()] try: self.msg.info(self.name, "Importing user hooks (hook.py)...") global hook import hook self.hooks_available = True except ImportError: self.msg.warn(self.name, "Error importing hooks.") del sys.path[0]
def _load(self, account): self.account = account # Create home directory utils.make_dir('') self.configfile = utils.get_root_filename('config.json') # Create user directory userfolder = "%s.%s" % (account['username'], account['api']) utils.make_dir(userfolder) self.msg.info( self.name, 'Trackma v{0} - using account {1}({2}).'.format( utils.VERSION, account['username'], account['api'])) self.msg.info(self.name, 'Reading config files...') try: self.config = utils.parse_config(self.configfile, utils.config_defaults) except IOError: raise utils.EngineFatal("Couldn't open config file.")
def load(self, account): self.account = account # Create home directory utils.make_dir('') self.configfile = utils.get_root_filename('config.json') # Create user directory userfolder = "%s.%s" % (account['username'], account['api']) utils.make_dir(userfolder) self.userconfigfile = utils.get_filename(userfolder, 'user.json') self.msg.info(self.name, 'Reading config files...') try: self.config = utils.parse_config(self.configfile, utils.config_defaults) self.userconfig = utils.parse_config(self.userconfigfile, utils.userconfig_defaults) except IOError: raise utils.EngineFatal("Couldn't open config file.")
def connect_signal(self, signal, callback): try: self.signals[signal] = callback except KeyError: raise utils.EngineFatal("Invalid signal.")