forked from huu-bo/micg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.py
39 lines (27 loc) · 769 Bytes
/
player.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
import json
import os
def saveConfig(username):
filename = "config.json"
if filename not in os.listdir('.'):
with open(filename, 'w') as file:
json.dump({}, file)
with open(filename, 'w') as file:
data = {
"config": {
"username": username,
}
}
json.dump(data, file)
def _update_user_name(name: str):
import main
main.username = name
pass
def loadConfig():
filename = "config.json"
if filename not in os.listdir('.'):
with open(filename, 'w') as file:
json.dump({}, file)
return
with open(filename, "r") as file:
data = json.load(file)
_update_user_name(data["config"]["username"])