forked from riyoken/project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
text.py
70 lines (65 loc) · 2.27 KB
/
text.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
67
68
69
70
import json
_board = dict()
f = open('board.txt', 'r')
print('Loading board...')
for line in f.readlines():
try:
if len(line) > 0:
key, post = json.loads(line.strip())
_board[key] = json.dumps(post)
except Exception as e:
print("Could not load board: %s" % e)
f.close()
_mods = list()
f = open('mods.txt', 'r')
print('Loading mods...')
for line in f.readlines():
try:
if len(line) > 0:
_mods.append(line.strip())
except Exception as e:
print("Could not load Mods: %s" % e)
f.close()
jsonrooms = dict()
room_list = []
lockrooms = []
f = open("jsonrooms.txt", "r")
print("Loading jsonrooms...")
for line in f.readlines():
try:
if len(line.strip()) > 0:
roomname, joiner, roomlock, jointime, locker, locktime = json.loads(line.strip())
jsonrooms[roomname] = json.dumps([joiner, roomlock, jointime, locker, locktime])
if roomname not in room_list:
room_list.append(roomname.strip())
else:
continue
if roomlock == "locked":
lockrooms.append(roomname.strip())
else:
continue
except Exception as e:
print("Could not load jsonrooms: %s" % e)
f.close()
notify = dict()
f = open("notify.txt", "r")
print('Loading notify...')
for line in f.readlines():
try:
if len(line.strip()) > 0:
user, message = json.loads(line.strip())
notify[user] = json.dumps(message)
except Exception as e:
print("Could not load notify: %s :%s" % (line, e))
f.close()
rmind = dict()
f = open("rmind.txt", "r")
print('Loading rmind...')
for line in f.readlines():
try:
if len(line.strip()) > 0:
mid, name, msg, user, stime = json.loads(line.strip())
rmind[mid] = json.dumps([name, msg, user, stime])
except:
print("Could not load rmind: %s" % line)
f.close()