'Main method to startup Tribler.'

def start_tribler(self, options):

    def on_tribler_shutdown(_):
        msg('Tribler    shut    down')
        reactor.stop()
        self.process_checker.remove_lock_file()
    def signal_handler(sig, _):
        msg(('Received    shut    down    signal    %s' % sig))
        if (not self._stopping):
            self._stopping = True
            self.session.shutdown().addCallback(on_tribler_shutdown)
    signal.signal(signal.SIGINT, signal_handler)
    signal.signal(signal.SIGTERM, signal_handler)
    config = TriblerConfig()
    config.set_torrent_checking_enabled(False)
    config.set_megacache_enabled(True)
    config.set_dispersy_enabled(True)
    config.set_mainline_dht_enabled(True)
    config.set_torrent_collecting_enabled(False)
    config.set_libtorrent_enabled(True)
    config.set_http_api_enabled(True)
    config.set_video_server_enabled(False)
    config.set_torrent_search_enabled(False)
    config.set_channel_search_enabled(False)
    self.process_checker = ProcessChecker()
    if self.process_checker.already_running:
        self.shutdown_process(('Another    Tribler    instance    is    already    using    statedir    %s' % config.get_state_dir()))
        return
    msg('Starting    Tribler')
    if options['statedir']:
        config.set_state_dir(options['statedir'])
    if (options['restapi'] > 0):
        config.set_http_api_enabled(True)
        config.set_http_api_port(options['restapi'])
    if ((options['dispersy'] != (-1)) and (options['dispersy'] > 0)):
        config.set_dispersy_port(options['dispersy'])
    if ((options['libtorrent'] != (-1)) and (options['libtorrent'] > 0)):
        config.set_listen_port(options['libtorrent'])
    self.session = Session(config)
    self.session.start().addErrback((lambda failure: self.shutdown_process(failure.getErrorMessage()))).addCallback(self.load_market_community)
    msg('Tribler    started')
