def run(self): # Get options via arg from couchpotato.runner import getOptions portable_path = os.path.join( base_path, '../..' ) #args = ['--quiet','--data_dir=' + portable_path + '/CouchPotatoData','--config_file=' + portable_path + '/CouchPotatoData/settings.conf'] args = ['--debug','--data_dir=' + portable_path + '/CouchPotatoData','--config_file=' + portable_path + '/CouchPotatoData/settings.conf'] self.options = getOptions(portable_path, args) # Load settings settings = Env.get('settings') settings.setFile(self.options.config_file) # Create data dir if needed self.data_dir = os.path.expanduser(Env.setting('data_dir')) if self.data_dir == '': from couchpotato.core.helpers.variable import getDataDir self.data_dir = getDataDir() self.data_dir = portable_path + '/CouchPotatoData' if not os.path.isdir(self.data_dir): os.makedirs(self.data_dir) # Create logging dir self.log_dir = os.path.join(self.data_dir, 'logs'); if not os.path.isdir(self.log_dir): os.mkdir(self.log_dir) try: from couchpotato.runner import runCouchPotato runCouchPotato(self.options, base_path, args, data_dir = self.data_dir, log_dir = self.log_dir, Env = Env, desktop = self._desktop) except: pass self._desktop.frame.Close()
def run(self): self.addSignals() from couchpotato.runner import runCouchPotato runCouchPotato(self.options, base_path, sys.argv[1:], data_dir = self.data_dir, log_dir = self.log_dir, Env = Env) if self.do_restart: self.restart()
def run(self): self.addSignals() try: from couchpotato.runner import runCouchPotato runCouchPotato(self.options, base_path, sys.argv[1:]) except (KeyboardInterrupt, SystemExit): pass except: self.log.critical(traceback.format_exc()) if self.do_restart: self.restart()
def main(): if os.environ.get('cp_main', 'false') == 'true': try: runCouchPotato(options, base_path, sys.argv[1:]) except Exception, e: log.critical(e)
new_environ = os.environ.copy() new_environ['cp_main'] = 'true' if os.name == 'nt': for key, value in new_environ.iteritems(): if isinstance(value, unicode): new_environ[key] = value.encode('iso-8859-1') subprocess.call(args, env=new_environ) return os.path.isfile(os.path.join(base_path, 'restart')) except Exception, e: log.critical(e) return 0 from couchpotato.runner import runCouchPotato if __name__ == '__main__': if os.environ.get('cp_main', 'false') == 'true': try: runCouchPotato(options, base_path, sys.argv[1:]) except Exception, e: log.critical(e) else: while 1: restart = start() if not restart: break sys.exit()
def main(): if os.environ.get("cp_main", "false") == "true": try: runCouchPotato(options, base_path, sys.argv[1:]) except Exception, e: log.critical(e)
args = [sys.executable] + sys.argv new_environ = os.environ.copy() new_environ['cp_main'] = 'true' if os.name == 'nt': for key, value in new_environ.iteritems(): if isinstance(value, unicode): new_environ[key] = value.encode('iso-8859-1') subprocess.call(args, env = new_environ) return os.path.isfile(os.path.join(base_path, 'restart')) except Exception, e: log.critical(e) return 0 from couchpotato.runner import runCouchPotato if __name__ == '__main__': if os.environ.get('cp_main', 'false') == 'true': try: runCouchPotato(options, base_path, sys.argv[1:]) except Exception, e: log.critical(e) else: while 1: restart = start() if not restart: break sys.exit()