Example #1
0
def init():
    global ip
    global address
    global weather

    sys.stdout.write("Initalizing")
    sys.stdout.flush()

    ip = info.getIp()
    if ip == -1:
        ip = "Error"
    sys.stdout.write("..")
    sys.stdout.flush()

    address = info.ipToAddress(ip)
    if address == -1:
        address = "Error"
    sys.stdout.write("..")
    sys.stdout.flush()

    weather = info.addressToWeather(address)
    if weather == -1 or weather == -2:
        weather = "Error"
    sys.stdout.write("..\n")
    sys.stdout.flush()
Example #2
0
def init():
    global ip
    global address
    global weather

    sys.stdout.write("Initalizing")
    sys.stdout.flush()

    ip = info.getIp()
    if (ip == -1):
        ip = "Error"
    sys.stdout.write("..")
    sys.stdout.flush()

    address = info.ipToAddress(ip)
    if (address == -1):
        address = "Error"
    sys.stdout.write("..")
    sys.stdout.flush()

    weather = info.addressToWeather(address)
    if (weather == -1 or weather == -2):
        weather = "Error"
    sys.stdout.write("..\n")
    sys.stdout.flush()
Example #3
0
            if ip != "Error":
                ip = colored(ip, "green", "on_blue")
            else:
                ip = info.getIp()
                if ip != -1:
                    ip = colored(ip, "green", "on_blue")
                else:
                    ip = colored("Error", "red", "on_blue")
            print ip

        # address
        if command == "address":
            if address != "Error":
                address = colored(address, "green", "on_blue")
            else:
                address = info.ipToAddress(info.getIp())
                if address != -1:
                    address = colored(address, "green", "on_blue")
                else:
                    address = colored("Error", "red", "on_blue")
            print address

        # weather
        m = re.match(r"^weather(|\s(\w*))$", command)
        if m:
            if m.group() == "weather":
                cityname = info.ipToAddress(info.getIp())

                if weather == "Error":
                    weather = info.addressToWeather(info.ipToAddress(info.getIp()))
                    if weather == -1:
Example #4
0
            if (ip != "Error"):
                ip = colored(ip, 'green', 'on_blue')
            else:
                ip = info.getIp()
                if (ip != -1):
                    ip = colored(ip, 'green', 'on_blue')
                else:
                    ip = colored("Error", 'red', 'on_blue')
            print ip

        #address
        if (command == "address"):
            if (address != "Error"):
                address = colored(address, 'green', 'on_blue')
            else:
                address = info.ipToAddress(info.getIp())
                if (address != -1):
                    address = colored(address, 'green', 'on_blue')
                else:
                    address = colored("Error", 'red', 'on_blue')
            print address

        #weather
        m = re.match(r"^weather(|\s(\w*))$", command)
        if (m):
            if (m.group() == "weather"):
                cityname = info.ipToAddress(info.getIp())

                if (weather == "Error"):
                    weather = info.addressToWeather(
                        info.ipToAddress(info.getIp()))