コード例 #1
0
def get_slp_results(ips):
    results = {}
    for ip in ips:
        status = mcstatus.McServer(ip, '25565')
        status.Update()
        results[ip] = status.available
    return results
コード例 #2
0
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()
コード例 #3
0
ファイル: app.py プロジェクト: SilverCory/mc-status-viewer
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
コード例 #4
0
                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):