def run_and_connect(urls):
    """Run the teamspeak client and connect to the first TS server if the user
    is not already connected to any of the servers in the list.

    This allows passing several addresses that the users may be using, like
    both the human-readable url and IP:port pair.
    """

    url_to_open = urls[0]

    if is_teamspeak_running():
        api_key = get_api_key()
        ts_servers = get_TS_servers_connected(api_key)
        for url in urls:
            host = url.split(':')[0]

            if host in ts_servers:
                Logger.info(
                    'TS: Teamspeak process found running and already connected to the right TS server.'
                )
                return

        Logger.info(
            'TS: Teamspeak process found running but NOT connected to any of the right TS server(s).'
        )
    else:
        Logger.info('TS: Running Teamspeak process not found.')

    full_url = 'ts3server://{}'.format(_sanitize_url(url_to_open))
    Logger.info(
        'TS: Connecting to teamspeak server: {} using the executable: {}'.
        format(full_url, get_executable_path()))
    call_args = [get_executable_path(), full_url]
    process_launcher.run(call_args, shell=True)
Esempio n. 2
0
def request_my_update(new_executable):
    """Update the executable being run with a new executable pointed by new_executable.
    The new_executable will be run with the path to this executable and a parameter indicating
    that an update has to take place."""
    my_executable_path = get_external_executable()

    args = call_file_arguments(new_executable)
    args.extend(['--', '-u', my_executable_path])

    Logger.info('Autoupdater: Will call with args: [{}]'.format(
        ', '.join(args)))
    process_launcher.run(args)
Esempio n. 3
0
def run_faceTrackNoIR():
    """Run faceTrackNoIR if installed and not already running."""

    try:
        faceTrackNoIR_path = get_faceTrackNoIR_path()

    except FaceTrackNoIRNotInstalled:
        Logger.info('FaceTrackNoIR: No FaceTrackNoIR installation found.')
        return

    if is_facetrackNoIR_running():
        Logger.info('FaceTrackNoIR: FaceTrackNoIR found already running.')
        return

    Logger.info('FaceTrackNoIR: Running file: {}'.format(faceTrackNoIR_path))
    process_launcher.run([faceTrackNoIR_path])
def run_opentrack():
    """Run Opentrack if installed and not already running."""

    try:
        opentrack_path = get_opentrack_path()

    except OpentrackNotInstalled:
        Logger.info('Opentrack: No FaceTrackNoIR installation found.')
        return

    if is_opentrack_running():
        Logger.info('Opentrack: FaceTrackNoIR found already running.')
        return

    Logger.info('Opentrack: Running file: {}'.format(opentrack_path))
    process_launcher.run([opentrack_path])
Esempio n. 5
0
    def run_arma3_launcher():
        """Run the original arma 3 launcher."""
        steam_exe_path = steam.get_steam_exe_path()  # May raise SteamNotInstalled!
        game_args = [steam_exe_path, '-applaunch', '107410']

        Logger.info('Arma: game args: [{}]'.format(', '.join(game_args)))
        popen_object = process_launcher.run(game_args)  # May raise OSError

        return popen_object
Esempio n. 6
0
    def run_game(mod_list=None, profile_name=None, custom_args=None, battleye=True,
                 ip=None, port=None, password=None, mission_file=None,
                 force_32bit=False, force_64bit=False):
        """Run the game in a separate process.

        All mods in mod_list are applied as command line parameters. The profile_name is also used.
        Custom_args are appended as is and special care must be taken when using spaces.
        The battleye variable allows to run the battleye-enhanced version of the game.

        Raises ArmaNotInstalled if Arma is not installed.
        Raises SteamNotInstalled if Steam is not installed.
        Raises OSError if running the executable fails."""

        game_args = Arma.get_args_to_execute(battleye=battleye,
                                             force_32bit=force_32bit,
                                             force_64bit=force_64bit)

        game_args.extend(['-nosplash', '-skipIntro'])

        if mod_list:
            modlist_argument = '-mod=' + ';'.join(mod_list)
            game_args.extend([modlist_argument])

        if profile_name:
            game_args.extend(['-name=' + profile_name])

        if ip:
            if not mission_file:
                game_args.extend(['-connect=' + ip])
            else:
                Logger.info('Arma: Mission file parameter present. Not connecting to server!')

        if port:
            game_args.extend(['-port=' + port])

        if password:
            game_args.extend(['-password='******'Arma: Running Arma: [{}]'.format(', '.join(game_args)))
        try:
            popen_object = process_launcher.run(game_args)  # May raise OSError

        except Exception as ex:
            Logger.error('Arma: Error while launching arma: {}'.format(ex))
            raise

        return popen_object
Esempio n. 7
0
def run_updated(old_executable_name):
    Logger.info('Autoupdater: Running the updated file: {}'.format(
        old_executable_name))
    args = call_file_arguments(old_executable_name)

    process_launcher.run(args)