Skip to content

Commit

Permalink
Update p2poolio.py
Browse files Browse the repository at this point in the history
update some stuff; improve debug
  • Loading branch information
OlMi1 authored Feb 18, 2023
1 parent 383bafa commit e5c4849
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions p2poolio.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 = {}
Expand All @@ -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
Expand Down Expand Up @@ -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()))

0 comments on commit e5c4849

Please sign in to comment.