-
Notifications
You must be signed in to change notification settings - Fork 0
/
miner.py
35 lines (31 loc) · 1023 Bytes
/
miner.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
import requests
import datetime
import json
from discord_hooks import Webhook
'''
2080SOL/S 579W
--------------
Mining: nyz.minex.
Uptime: start_time - now
GPU's:
0 : 50* 104W 524 SOL
0 : 50* 104W 524 SOL
0 : 50* 104W 524 SOL
0 : 50* 104W 524 SOL
'''
degree_sign= u'\N{DEGREE SIGN}'
url = 'webhook link'
link = "http://192.168.x.x:42000/getstat" # miner link
r = requests.get(url=link)
data = json.loads(r.text)
uptime = str(datetime.datetime.now()- datetime.datetime.fromtimestamp(int(data['start_time'])))[:-7]
gpuTxt = ""
totalSpeed = 0
totalWatt = 0
for gpu in data['result']:
gpuTxt += "\t{} : {}{}C {}W {}Sol/s\n".format(str(gpu['gpuid']),str(gpu['temperature']),degree_sign,str(gpu['gpu_power_usage']),str(gpu['speed_sps']))
totalSpeed += gpu['gpu_power_usage']
totalWatt += gpu['speed_sps']
msgTxt = "```css\n{}Sol/s {}W\n--------------\nServer: {}\nUptime: {}\nGPU's:\n{}\n```".format(str(totalWatt),str(totalSpeed),data['current_server'],str(uptime),gpuTxt)
msg = Webhook(url,msg=msgTxt)
msg.post()