def start_tribler_core(base_path):
 from twisted.internet import reactor
 def on_tribler_shutdown(_):
  reactor.stop()
 def shutdown(session, *_):
  logging.info('Stopping Tribler core')
  session.shutdown().addCallback(on_tribler_shutdown)
 sys.path.insert(0, base_path)
 def start_tribler():
  config = SessionStartupConfig().load()
  config.set_http_api_port(8085)
  config.set_http_api_enabled(True)
  process_checker = ProcessChecker()
  if process_checker.already_running:
   return
  session = Session(config)
  signal.signal(signal.SIGTERM, (lambda signum, stack: shutdown(session, signum, stack)))
  session.start()
 reactor.callWhenRunning(start_tribler)
 reactor.run()

def start_tribler_core ( base_path ) : from twisted . internet import reactor def on_tribler_shutdown ( _ ) : reactor . stop ( ) def shutdown ( session , * _ ) : logging . info ( 'Stopping Tribler core' ) session . shutdown ( ) . addCallback ( on_tribler_shutdown ) sys . path . insert ( 0 , base_path ) def start_tribler ( ) : config = SessionStartupConfig ( ) . load ( ) config . set_http_api_port ( 8085 ) config . set_http_api_enabled ( True ) process_checker = ProcessChecker ( ) if process_checker . already_running : return session = Session ( config ) signal . signal ( signal . SIGTERM , ( lambda signum , stack : shutdown ( session , signum , stack ) ) ) session . start ( ) reactor . callWhenRunning ( start_tribler ) reactor . run ( )
this method is invoked by multiprocessing when the tribler core is started and will start a tribler session .