def start(apptype, current_dir):
    try:
        config, fileargs = parseargs.parseargs(sys.argv, argsdef, presets={})
    except Exception as e:
        print >> sys.stderr, e
        os._exit(1)

    if config['name'] == '':
        print >> sys.stderr, 'Usage:  ', get_usage(argsdef)
        os._exit(0)
    debug_level = config['debug']
    ACEStream.Core.BitTornado.SocketHandler.DEBUG = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Choker.DEBUG = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Connecter.DEBUG = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Downloader.DEBUG = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Encrypter.DEBUG = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Encrypter.DEBUG_CLOSE = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Rerequester.DEBUG = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Rerequester.DEBUG_DHT = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Rerequester.DEBUG_CHECK_NETWORK_CONNECTION = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.track.DEBUG = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.StorageWrapper.DEBUG_LIVE = debug_level == -1 or debug_level & 16 != 0
    ACEStream.Core.Video.VideoSource.DEBUG = debug_level == -1 or debug_level & 16 != 0
    ACEStream.Core.NATFirewall.NatCheck.DEBUG = debug_level & 64 != 0
    ACEStream.Core.NATFirewall.UPnPThread.DEBUG = debug_level & 64 != 0
    ACEStream.Core.NATFirewall.UDPPuncture.DEBUG = debug_level & 64 != 0
    ACEStream.Core.NATFirewall.upnp.DEBUG = debug_level & 64 != 0
    ACEStream.Core.NATFirewall.ConnectionCheck.DEBUG = debug_level & 64 != 0
    ACEStream.Core.BitTornado.RawServer.DEBUG = debug_level & 512 != 0
    ACEStream.Core.BitTornado.RawServer.DEBUG2 = debug_level & 512 != 0
    ACEStream.Core.BitTornado.ServerPortHandler.DEBUG = debug_level & 512 != 0
    ACEStream.Core.BitTornado.ServerPortHandler.DEBUG2 = debug_level & 512 != 0
    ACEStream.Core.BitTornado.HTTPHandler.DEBUG = debug_level & 512 != 0
    ACEStream.Core.BitTornado.HTTPHandler.DEBUG2 = debug_level & 512 != 0
    ACEStream.Core.BitTornado.SocketHandler.DEBUG = debug_level & 512 != 0
    ACEStream.Core.BitTornado.SocketHandler.DEBUG2 = debug_level & 512 != 0
    globalConfig.set_value('apptype', apptype)
    if apptype == 'torrentstream':
        appname = 'Torrent Stream'
    else:
        appname = 'ACE Stream HD'
    app = StreamApp(appname, current_dir)
    iconpath = os.path.join(current_dir, 'data', 'images', 'stream.ico')
    wrapper = AppWrapper()
    wrapper.set_bgapp(app)
    wrapper.set_icon(iconpath)
    app.set_wrapper(wrapper)
    webui_server = WebUIServer(6879, app)
    webui_server.background_serve()
    app.start_stream(config)
    wrapper.MainLoop()
    app.OnExit()
    os._exit(0)
def start(apptype, current_dir):
    try:
        config, fileargs = parseargs.parseargs(sys.argv, argsdef, presets={})
    except Exception as e:
        print >> sys.stderr, e
        os._exit(1)

    if config['name'] == '':
        print >> sys.stderr, 'Usage:  ', get_usage(argsdef)
        os._exit(0)
    debug_level = config['debug']
    ACEStream.Core.BitTornado.SocketHandler.DEBUG = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Choker.DEBUG = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Connecter.DEBUG = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Downloader.DEBUG = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Encrypter.DEBUG = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Encrypter.DEBUG_CLOSE = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Rerequester.DEBUG = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Rerequester.DEBUG_DHT = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.Rerequester.DEBUG_CHECK_NETWORK_CONNECTION = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.track.DEBUG = debug_level & 8 != 0
    ACEStream.Core.BitTornado.BT1.StorageWrapper.DEBUG_LIVE = debug_level == -1 or debug_level & 16 != 0
    ACEStream.Core.Video.VideoSource.DEBUG = debug_level == -1 or debug_level & 16 != 0
    ACEStream.Core.NATFirewall.NatCheck.DEBUG = debug_level & 64 != 0
    ACEStream.Core.NATFirewall.UPnPThread.DEBUG = debug_level & 64 != 0
    ACEStream.Core.NATFirewall.UDPPuncture.DEBUG = debug_level & 64 != 0
    ACEStream.Core.NATFirewall.upnp.DEBUG = debug_level & 64 != 0
    ACEStream.Core.NATFirewall.ConnectionCheck.DEBUG = debug_level & 64 != 0
    ACEStream.Core.BitTornado.RawServer.DEBUG = debug_level & 512 != 0
    ACEStream.Core.BitTornado.RawServer.DEBUG2 = debug_level & 512 != 0
    ACEStream.Core.BitTornado.ServerPortHandler.DEBUG = debug_level & 512 != 0
    ACEStream.Core.BitTornado.ServerPortHandler.DEBUG2 = debug_level & 512 != 0
    ACEStream.Core.BitTornado.HTTPHandler.DEBUG = debug_level & 512 != 0
    ACEStream.Core.BitTornado.HTTPHandler.DEBUG2 = debug_level & 512 != 0
    ACEStream.Core.BitTornado.SocketHandler.DEBUG = debug_level & 512 != 0
    ACEStream.Core.BitTornado.SocketHandler.DEBUG2 = debug_level & 512 != 0
    globalConfig.set_value('apptype', apptype)
    if apptype == 'torrentstream':
        appname = 'Torrent Stream'
    else:
        appname = 'ACE Stream HD'
    app = StreamApp(appname, current_dir)
    iconpath = os.path.join(current_dir, 'data', 'images', 'stream.ico')
    wrapper = AppWrapper()
    wrapper.set_bgapp(app)
    wrapper.set_icon(iconpath)
    app.set_wrapper(wrapper)
    webui_server = WebUIServer(6879, app)
    webui_server.background_serve()
    app.start_stream(config)
    wrapper.MainLoop()
    app.OnExit()
    os._exit(0)
def track(args):
    if not args:
        print formatDefinitions(defaults, 80)
        return
    try:
        config, files = parseargs(args, defaults, 0, 0)
    except ValueError as e:
        print 'error: ' + str(e)
        print 'run with no arguments for parameter explanations'
        return

    r = RawServer(Event(), config['tracker_timeout_check_interval'], config['tracker_socket_timeout'], ipv6_enable=config['ipv6_enabled'])
    t = Tracker(config, r)
    r.bind(config['minport'], config['bind'], reuse=True, ipv6_socket_style=config['ipv6_binds_v4'])
    r.listen_forever(HTTPHandler(t.get, config['min_time_between_log_flushes']))
    t.save_state()
    print '# Shutting down: ' + isotime()
예제 #4
0
def track(args):
    if not args:
        print formatDefinitions(defaults, 80)
        return
    try:
        config, files = parseargs(args, defaults, 0, 0)
    except ValueError as e:
        print 'error: ' + str(e)
        print 'run with no arguments for parameter explanations'
        return

    r = RawServer(Event(),
                  config['tracker_timeout_check_interval'],
                  config['tracker_socket_timeout'],
                  ipv6_enable=config['ipv6_enabled'])
    t = Tracker(config, r)
    r.bind(config['minport'],
           config['bind'],
           reuse=True,
           ipv6_socket_style=config['ipv6_binds_v4'])
    r.listen_forever(HTTPHandler(t.get,
                                 config['min_time_between_log_flushes']))
    t.save_state()
    print '# Shutting down: ' + isotime()