コード例 #1
0
def setup_ip(self):
    """
    If auto detect ip is enabled, this function will attempt to configure the ip
    address, otherwise if static ip is enabled, this function will
    verify whether a yamaha receiver can be found at the given static ip.
    """
    if self.ip_auto_detect:
        print "Searching for Yamaha Recievers ({0})...".format(
            self.auto_detect_model)
        ip = auto_detect_ip_threaded(self)
        if ip is not None:
            self.ip_address = ip
            return ip
    else:
        try:
            model = yamaha.get_config_string(self,
                                             'Model_Name',
                                             timeout=self.auto_detect_timeout,
                                             ip=self.ip_address,
                                             print_error=False)
            print "Found Yamaha Receiver: {0} [{1}]".format(
                self.ip_address, model)
            return self.ip_address
        except:
            eg.PrintError("Yamaha Receiver Not Found [{0}]!".format(
                self.ip_address))
    return None
コード例 #2
0
def try_connect(ip):
    """
    Used with the auto-detect-ip functions, determines if a yamaha receiver is
    waiting at the other end of the given ip address.
    """
    try:
        model = yamaha.get_config_string('Model_Name', timeout=globals.auto_detect_timeout, ip=ip, print_error=False)
        print '{0}: {1}'.format(ip, model)
        if globals.auto_detect_model in ["ANY", "", None] or model.upper() == globals.auto_detect_model.upper():
            globals.FOUND_IP = ip
            globals.MODEL = model
    except:
        pass
コード例 #3
0
def try_connect(ip):
    try:
        model = yamaha.get_config_string('Model_Name', float(globals.auto_detect_timeout), ip=ip)
        print '{0}: {1}'.format(ip, model)
        if globals.auto_detect_model.upper() == "ANY" \
                or globals.auto_detect_model == "" \
                or globals.auto_detect_model is None\
                or model.lower() == globals.auto_detect_model.lower():
            globals.FOUND_IP = ip
            globals.MODEL = model
    except:
        #print '{0}: ...'.format(ip)
        pass
コード例 #4
0
def try_connect(self, ip):
    """
    Used with the auto-detect-ip functions, determines if a yamaha receiver is
    waiting at the other end of the given ip address.
    """
    #print "value in self.active_zone " + str(self.active_zone)
    #print "try connect " + ip
    try:
        model = yamaha.get_config_string(self,'Model_Name', timeout=self.auto_detect_timeout, ip=ip, print_error=False)
        print '{0}: {1}'.format(ip, model)
        if self.auto_detect_model in ["ANY", "", None] or model.upper() == self.auto_detect_model.upper():
            self.FOUND_IP = ip
            self.MODEL = model
    except:
        pass
コード例 #5
0
def try_connect(self, ip):
    """
    Used with the auto-detect-ip functions, determines if a yamaha receiver is
    waiting at the other end of the given ip address.
    """
    #print "value in self.active_zone " + str(self.active_zone)
    #print "try connect " + ip
    try:
        model = yamaha.get_config_string(self,'Model_Name', timeout=self.auto_detect_timeout, ip=ip, print_error=False)
        print '{0}: {1}'.format(ip, model)
        if self.auto_detect_model in ["ANY", "", None] or model.upper() == self.auto_detect_model.upper():
            self.FOUND_IP = ip
            self.MODEL = model
    except:
        pass
コード例 #6
0
def auto_detect_ip():
    start = datetime.now()
    found_ip = None
    ip_range = create_ip_range(globals.ip_range_start, globals.ip_range_end)
    for ip in ip_range:
        try:
            model = yamaha.get_config_string('Model_Name', float(globals.auto_detect_timeout), ip=ip)
            print '{0}: {1}'.format(ip, model)
            if model.upper() == "ANY" or model == "" or model is None \
                    or model.lower() == globals.auto_detect_model.lower():
                found_ip = ip
                break
        except:
            print '{0}: ...'.format(ip)
            #print traceback.format_exc()
    end = datetime.now()
    delta = end-start
    print "finished in", delta.total_seconds(), "seconds"
    return found_ip
コード例 #7
0
def setup_ip(self):
    """
    If auto detect ip is enabled, this function will attempt to configure the ip
    address, otherwise if static ip is enabled, this function will
    verify whether a yamaha receiver can be found at the given static ip.
    """
    if self.ip_auto_detect:
        print "Searching for Yamaha Recievers ({0})...".format(self.auto_detect_model)
        ip = auto_detect_ip_threaded(self)
        if ip is not None:
            self.ip_address = ip
            return ip
    else:
        try:
            model = yamaha.get_config_string(self, 'Model_Name', timeout=self.auto_detect_timeout, ip=self.ip_address, print_error=False)
            print "Found Yamaha Receiver: {0} [{1}]".format(self.ip_address, model)
            return self.ip_address
        except:
            eg.PrintError("Yamaha Receiver Not Found [{0}]!".format(self.ip_address))
    return None