-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbit_info_test.py
More file actions
33 lines (27 loc) · 846 Bytes
/
bit_info_test.py
File metadata and controls
33 lines (27 loc) · 846 Bytes
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
import sys
import json
bitInfo = {'link_7777_total_bits': 0}
def UpdateBits(epoch, user, count):
if user in bitInfo:
bitInfo[user] += count
else:
bitInfo[user] = count
bitInfo['link_7777_total_bits'] += count
LogBits(epoch, user, str(count))
SaveBitInfo()
def SaveBitInfo():
bitInfoFile = open("bit_info.json", 'w')
json.dump(bitInfo, bitInfoFile)
bitInfoFile.close()
def LoadBitInfo():
global bitInfo
bitInfoFile = open("bit_info.json", 'r')
bitInfo = json.load(bitInfoFile)
bitInfoFile.close()
def LogBits(epoch, user, count):
bitLog = open("bit_log.txt", 'a')
bitLog.write(epoch + ", " + user + ", " + count + "\n")
bitLog.close()
LoadBitInfo()
print(bitInfo['link_7777_total_bits'])
UpdateBits('1494830731290', 'ev_brak', 100)