-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
57 lines (44 loc) · 1.8 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import asyncio
import os
from app.fetcher import fetch_game_servers
def cls():
os.system('cls' if os.name=='nt' else 'clear')
def display_server_details(servers):
"""Display raw server details in a readable format."""
if not servers:
print("No servers found.")
else:
for i, server in enumerate(servers, start=1):
print(f"Server {i}:")
print(f" Game Name: {server.game_name}")
print(f" Game Mode: {server.get_game_mode()}")
print(f" IP Address (IPv4): {server.address_ipv4}")
#print(f" IP Address (IPv6): {server.address_ipv6}")
#print(f" LIP: {server.lip}")
print(f" Port: {server.port}")
print(f" Map Name: {server.map_name}")
print(f" Players: {server.players}")
print(f" Max Players: {server.max_players}")
if server.bots > 0:
print(f" Bots: {server.bots}")
print(f" Has Password: {server.has_password}")
if server.description:
print(f" Description: {server.description}")
print(f" Version: {server.version}")
print(f" Version Number: {server.version_nr}")
print(f" Application Instance: {server.application_instance}")
print("-" * 50)
def main():
"""Main function to fetch and display servers."""
print("Fetching game servers...")
# Fetch servers asynchronously
servers = asyncio.run(fetch_game_servers())
cls()
print("\n--- Game Servers Details ---")
print(f"Total Players: {sum(server.players for server in servers)}")
print("-" * 50)
display_server_details(servers)
# Wait for the user to press any key to continue
input("\nPress any key to continue...")
if __name__ == "__main__":
main()