57 lines
1.3 KiB
Plaintext
57 lines
1.3 KiB
Plaintext
|
#!/usr/bin/env python3
|
||
|
|
||
|
import subprocess
|
||
|
import json
|
||
|
|
||
|
|
||
|
def __LBC():
|
||
|
data = subprocess.run(
|
||
|
["lbrynet", "account", "list"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||
|
)
|
||
|
if data.stderr != b'':
|
||
|
return None
|
||
|
data = json.loads(data.stdout)
|
||
|
balance: float = 0
|
||
|
for i in range(len(data["items"])):
|
||
|
d = data["items"][i]["coins"]
|
||
|
balance += float(d)
|
||
|
return round(balance, 1)
|
||
|
|
||
|
|
||
|
def __DOGE():
|
||
|
try:
|
||
|
data = subprocess.run(
|
||
|
["dogecoin-cli", "getbalance"],
|
||
|
stdout=subprocess.PIPE,
|
||
|
stderr=subprocess.PIPE,
|
||
|
)
|
||
|
if data.stderr != b'':
|
||
|
return None
|
||
|
balance = json.loads(data.stdout)
|
||
|
return round(balance, 1)
|
||
|
except json.decoder.JSONDecodeError:
|
||
|
return None
|
||
|
|
||
|
|
||
|
def __BTC():
|
||
|
try:
|
||
|
data = subprocess.run(
|
||
|
["bitcoin-cli", "getbalance"],
|
||
|
stdout=subprocess.PIPE,
|
||
|
stderr=subprocess.PIPE,
|
||
|
)
|
||
|
if data.stderr != b'':
|
||
|
return None
|
||
|
balance = json.loads(data.stdout)
|
||
|
return round(balance, 1)
|
||
|
except json.decoder.JSONDecodeError:
|
||
|
return None
|
||
|
|
||
|
|
||
|
def main():
|
||
|
print(f" LBC: {__LBC()}, DOGE: {__DOGE()}, BTC: {__BTC()}")
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
main()
|