diff --git a/p2poolio.py b/p2poolio.py index 944118e..f8ef65c 100644 --- a/p2poolio.py +++ b/p2poolio.py @@ -1,9 +1,7 @@ # the payout variable always holds the most recent one # i am a cluttered mess written in like 10 minutes, so don't be too harsh :) -# data is a json mess (lines only if read is called with returnLines=True). View readme.md for more info -# Options for init: path (default: p2pool.log - must point to p2pool.log) -# Options for read: path (default: p2pool.log - must point to p2pool.log), returnLines (default: False), linelimit (default: 100) +# View readme.md for more info & syntax import time import datetime @@ -14,7 +12,7 @@ def read(path: str = "p2pool.log", returnLines: bool = False, linelimit: int = 1 starttime = time.time() if (not os.path.exists(path)): - raise Exception('The given path does not exist! Check for {path}') + raise Exception(f'The given path does not exist! Check for {os.path.abspath(os.getcwd())}\{path}') lines = [] payout = {} @@ -39,7 +37,7 @@ def read(path: str = "p2pool.log", returnLines: bool = False, linelimit: int = 1 line = " ".join(splits[4:]) # Your wallet ... didn't get a payout in block 2814592 because you had no shares in PPLNS window - # Your wallet ... got a payout of 0.001077410546 XMR in block 2814766 + # Your wallet ... got a payout of 0.12345 XMR in block 2820000 hasPayout: bool = (module == "P2Pool" and line.startswith("Your wallet") and "got a payout" in line and not "no shares" in line and payout == {}) payoutdata = { "payout": hasPayout @@ -75,4 +73,5 @@ def read(path: str = "p2pool.log", returnLines: bool = False, linelimit: int = 1 return returndata -print(P2PoolIO.read()) +import json +print(json.dumps(P2PoolIO.read()))