(self, interactive=True, src_port=None, interface=None)
Discover the Sat-IP receivers in the local network via UPnP
Discover the Sat-IP receivers in the local network via UPnP
Discover the Sat - IP receivers in the local network via UPnP
def discover(self, interactive=True, src_port=None, interface=None):
        """Discover the Sat-IP receivers in the local network via UPnP"""
        upnp = UPnP(src_port, interface)
        devices = upnp.discover()

        if (len(devices) == 0):
            return

        # Filter the Sat-IP devices
        sat_ip_devices = [{
            'host': d.host,
            'base_url': d.base_url
        } for d in devices if d.friendly_name == "SELFSAT-IP"]
        # Note: convert to dictionary so that _ask_multiple_choice can
        # deep-copy the selected element (which would not work for the original
        # SSDPDevice object).

        if (len(sat_ip_devices) == 0):
            return

        if (len(sat_ip_devices) > 1):
            if (not interactive):
                logger.warning("Found multiple Sat-IP receivers.")
                logger.warning("Selecting the receiver at {}".format(
                    sat_ip_devices[0]['host']))
                logger.info(
                    "You can specify the receiver using option -a/--addr or "
                    "run in interactive mode")
                self._set_from_ssdp_dev(sat_ip_devices[0])
            else:
                logger.info("Found multiple Sat-IP receivers.")
                selected = util.ask_multiple_choice(
                    sat_ip_devices,
                    "Select the Sat-IP receiver by IP address:",
                    "Sat-IP receiver",
                    lambda x: "Receiver at {}".format(x['host']))
                self._set_from_ssdp_dev(selected)
        else:
            self._set_from_ssdp_dev(sat_ip_devices[0])
def discover ( self , interactive = True , src_port = None , interface = None ) : upnp = UPnP ( src_port , interface ) devices = upnp . discover ( ) if ( len ( devices ) == 0 ) : return # Filter the Sat-IP devices sat_ip_devices = [ { 'host' : d . host , 'base_url' : d . base_url } for d in devices if d . friendly_name == "SELFSAT-IP" ] # Note: convert to dictionary so that _ask_multiple_choice can # deep-copy the selected element (which would not work for the original # SSDPDevice object). if ( len ( sat_ip_devices ) == 0 ) : return if ( len ( sat_ip_devices ) > 1 ) : if ( not interactive ) : logger . warning ( "Found multiple Sat-IP receivers." ) logger . warning ( "Selecting the receiver at {}" . format ( sat_ip_devices [ 0 ] [ 'host' ] ) ) logger . info ( "You can specify the receiver using option -a/--addr or " "run in interactive mode" ) self . _set_from_ssdp_dev ( sat_ip_devices [ 0 ] ) else : logger . info ( "Found multiple Sat-IP receivers." ) selected = util . ask_multiple_choice ( sat_ip_devices , "Select the Sat-IP receiver by IP address:" , "Sat-IP receiver" , lambda x : "Receiver at {}" . format ( x [ 'host' ] ) ) self . _set_from_ssdp_dev ( selected ) else : self . _set_from_ssdp_dev ( sat_ip_devices [ 0 ] )