-
Notifications
You must be signed in to change notification settings - Fork 3
/
utils.py
44 lines (37 loc) · 1.08 KB
/
utils.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
import json
base_path = ""
accountdb = "accountdb.json"
# OPTIONS
options = {}
defaultoptions = {
"toscan": [],
"shortsleep": 1, # min. seconds between API requests - avoid hitting the rate-limit
"longsleep": 120, # min. seconds between scans and after errors such as PoE being down etc.
"maxlevel": 90, # ignore characters at this level or higher
"minlevel": 10, # ignore new characters above this level
"POBTREEVER": "3_20" # league tag for PoB and passive-tree
}
def getopt(opt):
global options
if opt in options:
return options[opt]
else:
return 0
def setopt(opt,val):
global options
options[opt] = val
saveopt()
def saveopt():
global options
with open('settings.json', 'w') as outfile:
json.dump(options, outfile, sort_keys=True, indent=4)
def loadopt():
global options,defaultoptions
try:
with open('settings.json') as json_file:
options = json.load(json_file)
except:
options = {}
options = {**defaultoptions, **options}
saveopt()
loadopt()