()
return setup
Configure Rx setup - which receiver user is using
Configure Rx setup - which receiver user is using
Configure Rx setup - which receiver user is using
def _cfg_rx_setup():
    """Configure Rx setup - which receiver user is using """
    os.system('clear')
    util.print_header("Receiver")

    # Receiver
    question = "Select your DVB-S2 receiver:"
    setup = util.ask_multiple_choice(
        defs.demods, question, "Receiver",
        lambda x: '{} receiver'.format(_get_rx_marketing_name(x)))

    # Network interface connected to the standalone receiver
    if (setup['type'] == defs.standalone_setup_type):
        try:
            devices = os.listdir('/sys/class/net/')
        except FileNotFoundError:
            devices = None
            pass

        question = "Which network interface is connected to the receiver?"
        if (devices is not None):
            netdev = util.ask_multiple_choice(devices, question, "Interface",
                                              lambda x: '{}'.format(x))
        else:
            netdev = input(question + " ")

        setup['netdev'] = netdev.strip()

        custom_ip = util.ask_yes_or_no(
            "Have you manually assigned a custom IP address to the receiver?",
            default="n")
        if (custom_ip):
            ipv4_addr = util.typed_input("Which IPv4 address?",
                                         in_type=IPv4Address)
            setup["rx_ip"] = str(ipv4_addr)
        else:
            setup["rx_ip"] = defs.default_standalone_ip_addr

    # Define the Sat-IP antenna directly without asking the user
    if (setup['type'] == defs.sat_ip_setup_type):
        # NOTE: this works as long as there is a single Sat-IP antenna in the
        # list. In the future, if other Sat-IP antennas are included, change to
        # a multiple-choice prompt.
        for antenna in defs.antennas:
            if antenna['type'] == 'sat-ip':
                setup['antenna'] = antenna
                return setup
        # We should have returned in the preceding line.
        raise RuntimeError("Failed to find antenna of {} receiver".format(
            defs.sat_ip_setup_type))

    # Antenna
    setup['antenna'] = _ask_antenna()

    return setup
def _cfg_rx_setup ( ) : os . system ( 'clear' ) util . print_header ( "Receiver" ) # Receiver question = "Select your DVB-S2 receiver:" setup = util . ask_multiple_choice ( defs . demods , question , "Receiver" , lambda x : '{} receiver' . format ( _get_rx_marketing_name ( x ) ) ) # Network interface connected to the standalone receiver if ( setup [ 'type' ] == defs . standalone_setup_type ) : try : devices = os . listdir ( '/sys/class/net/' ) except FileNotFoundError : devices = None pass question = "Which network interface is connected to the receiver?" if ( devices is not None ) : netdev = util . ask_multiple_choice ( devices , question , "Interface" , lambda x : '{}' . format ( x ) ) else : netdev = input ( question + " " ) setup [ 'netdev' ] = netdev . strip ( ) custom_ip = util . ask_yes_or_no ( "Have you manually assigned a custom IP address to the receiver?" , default = "n" ) if ( custom_ip ) : ipv4_addr = util . typed_input ( "Which IPv4 address?" , in_type = IPv4Address ) setup [ "rx_ip" ] = str ( ipv4_addr ) else : setup [ "rx_ip" ] = defs . default_standalone_ip_addr # Define the Sat-IP antenna directly without asking the user if ( setup [ 'type' ] == defs . sat_ip_setup_type ) : # NOTE: this works as long as there is a single Sat-IP antenna in the # list. In the future, if other Sat-IP antennas are included, change to # a multiple-choice prompt. for antenna in defs . antennas : if antenna [ 'type' ] == 'sat-ip' : setup [ 'antenna' ] = antenna return setup # We should have returned in the preceding line. raise RuntimeError ( "Failed to find antenna of {} receiver" . format ( defs . sat_ip_setup_type ) ) # Antenna setup [ 'antenna' ] = _ask_antenna ( ) return setup