diff --git a/dump.py b/dump.py index abab08c..6ec1389 100644 --- a/dump.py +++ b/dump.py @@ -1,8 +1,13 @@ +#Get home dir +from subprocess import getoutput +global home +home = getoutput("echo $HOME") + #Json import json def read(): - global db - with open('db.json', 'r') as openfile: + global db, home + with open(f'{home}/db.json', 'r') as openfile: db = json.load(openfile) diff --git a/ping.py b/ping.py index 62a1766..1eccd26 100644 --- a/ping.py +++ b/ping.py @@ -1,17 +1,22 @@ from mctools import PINGClient -ping = PINGClient('play.dmcraft.online') +ping = PINGClient('135.181.170.94',25630) #stats = ping.get_stats() +#Get home dir +from subprocess import getoutput +global home +home = getoutput("echo $HOME") + #Work with JSON import json def read(): - global db - with open('db.json', 'r') as openfile: + global db, home + with open(f'{home}/db.json', 'r') as openfile: db = json.load(openfile) def write(): global db js = json.dumps(db, indent=4) - with open("db.json", "w") as outfile: + with open(f'{home}/db.json', 'w') as outfile: outfile.write(js) #My libraries @@ -39,6 +44,6 @@ while True: ttime = 0 except Exception as e: - ping = PINGClient('play.dmcraft.online') + ping = PINGClient('135.181.170.94',25630) print(e)