forked from Ridepad/uwu-logs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
h_server_fix.py
66 lines (53 loc) · 1.57 KB
/
h_server_fix.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
58
59
60
61
62
63
64
65
66
import re
class ServerID:
__slots__ = "name", "re_string"
def __init__(self, name: str, re_string: str) -> None:
self.name = name
self.re_string = re_string
@property
def no_space(self):
return self.name.replace(" ", "-")
@property
def html(self):
return self.no_space.lower()
def __str__(self):
return ' | '.join((
self.name,
self.re_string,
self.no_space,
self.html,
))
__repr__ = __str__
SERVERS_OTHER = [
ServerID("Rising Gods", "(risin.*?god)"),
ServerID("WoW Circle", "(circle)"),
ServerID("Whitemane-PTR", "(whitemane.*?ptr)"),
ServerID("Whitemane-Frostmourne", "(frostmo)"),
ServerID("Whitemane-Frostmourne", "(whitema)"),
ServerID("WoW-Mania", "(mania)"),
ServerID("ChromieCraft", "(chromie.*?craft)"),
ServerID("EzWoW", "(ez.*?wow)"),
ServerID("NaerZone", "(naer.*?zone)"),
ServerID("Way of Elendil", "(way.*?elendil)"),
ServerID("WoW Brasil", "(wow.*?brasil)"),
# ServerName("", ""),
]
def server_cnv(server: str) -> None:
if not server:
return None
_server_l = server.lower()
for _server in SERVERS_OTHER:
if re.findall(_server.re_string, _server_l):
return _server.no_space
return None
def test1():
z = server_cnv("Wow Circle 3.3.5a x5")
print(z)
z = server_cnv("rIsing godSs")
print(z)
z = server_cnv("risINGg godds")
print(z)
z = server_cnv("Way-of-Elendil")
print(z)
if __name__ == "__main__":
test1()