def get_slp_results(ips): results = {} for ip in ips: status = mcstatus.McServer(ip, '25565') status.Update() results[ip] = status.available return results
def manual_run(): for category in servers_config: print category data[category] = {} for server in servers_config[category]: print "- " + server + ": " + servers_config[category][server] ip = servers_config[category][server] if "/" not in ip: ip += "/25565" status = mcstatus.McServer(ip.split("/")[0], ip.split("/")[1]) # c += 1 data[category][server] = status generate_json()
def update_config(): with open('config.yml', 'r') as cfg_file: servers_config = yaml.load(cfg_file) for category in servers_config: print category data[category] = {} for server in servers_config[category]: print "- " + server + ": " + servers_config[category][server] ip = servers_config[category][server] if "/" not in ip: ip += "/25565" status = mcstatus.McServer(ip.split("/")[0], ip.split("/")[1]) data[category][server] = status
ip += "/25565" status = mcstatus.McServer(ip.split("/")[0], ip.split("/")[1]) # c += 1 data[category][server] = status generate_json() for category in servers_config: print category data[category] = {} for server in servers_config[category]: print "- " + server + ": " + servers_config[category][server] ip = servers_config[category][server] if "/" not in ip: ip += "/25565" status = mcstatus.McServer(ip.split("/")[0], ip.split("/")[1]) # c += 1 data[category][server] = status def update_all(): # i = 0.0 for category in data: # d = 5.0 / c for server in data[category]: # i += 1.0 status = data[category][server] threading.Thread(target=lambda: status.Update()).start() def sort_dict_by_key(to_sort):