(user_info)
return interface
Get the network interface used by the given setup
Get the network interface used by the given setup
Get the network interface used by the given setup
def get_net_if(user_info):
    """Get the network interface used by the given setup"""
    if (user_info is None):
        raise ValueError("Failed to read local configuration")

    setup_type = user_info['setup']['type']

    if (setup_type in [defs.sdr_setup_type, defs.sat_ip_setup_type]):
        interface = "lo"
    elif (setup_type == defs.linux_usb_setup_type):
        if ('adapter' not in user_info['setup']):
            interface = "dvb0_0"
            logger.warning("Could not find the dvbnet interface name. "
                           "Is the {} receiver running?".format(
                               get_rx_model(user_info)))
            logger.warning("Assuming interface name {}.".format(interface))
        else:
            adapter = user_info['setup']['adapter']
            interface = "dvb{}_0".format(adapter)
    elif (setup_type == defs.standalone_setup_type):
        interface = user_info['setup']['netdev']
    else:
        raise ValueError("Unknown setup type")
    return interface
def get_net_if ( user_info ) : if ( user_info is None ) : raise ValueError ( "Failed to read local configuration" ) setup_type = user_info [ 'setup' ] [ 'type' ] if ( setup_type in [ defs . sdr_setup_type , defs . sat_ip_setup_type ] ) : interface = "lo" elif ( setup_type == defs . linux_usb_setup_type ) : if ( 'adapter' not in user_info [ 'setup' ] ) : interface = "dvb0_0" logger . warning ( "Could not find the dvbnet interface name. " "Is the {} receiver running?" . format ( get_rx_model ( user_info ) ) ) logger . warning ( "Assuming interface name {}." . format ( interface ) ) else : adapter = user_info [ 'setup' ] [ 'adapter' ] interface = "dvb{}_0" . format ( adapter ) elif ( setup_type == defs . standalone_setup_type ) : interface = user_info [ 'setup' ] [ 'netdev' ] else : raise ValueError ( "Unknown setup type" ) return interface