Advertisement
Guest User

EyesOnMiner-Beta5 source code

a guest
Mar 20th, 2016
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.26 KB | None | 0 0
  1. ##Basic Miner watching program written in python
  2. ##L8nit3tr0ubl3
  3.  
  4. ##Import required modules
  5. from pycgminer import CgminerAPI
  6. import socket
  7. import json
  8. import os
  9. from time import sleep
  10. from easygui import *
  11.  
  12. ##Define 'cgminer' as per 'Thomas Sileo's' instructions
  13. cgminer = CgminerAPI()
  14.  
  15. ##Modify host using user input
  16. msg1 = "Please enter your miner IP.\n"
  17. title1 = "L8nit3's EyesOnMiner-Beta3"
  18. cgminer.host = enterbox(msg1,title1)
  19.  
  20. msg2 = "How often should the data update? in seconds.\n"
  21. update = enterbox(msg2,title1)
  22.  
  23. ##Define devices and correct data for display
  24. def antminer():
  25.        
  26.     loop = 1
  27.    
  28.     while loop == 1:
  29.         summary = cgminer.summary()
  30.        
  31.         HW = float(summary['SUMMARY'][0]['Hardware Errors'])
  32.         diffa = float(summary['SUMMARY'][0]['Difficulty Accepted'])
  33.         diffr = float(summary['SUMMARY'][0]['Difficulty Rejected'])
  34.        
  35.         x = HW + diffa + diffr
  36.  
  37.         speed = summary['SUMMARY'][0]['GHS 5s']
  38.         accepted = summary['SUMMARY'][0]['Accepted']
  39.         best = summary['SUMMARY'][0]['Best Share']
  40.         rejected = round(summary['SUMMARY'][0]['Device Rejected%'],6)
  41.         percent = round(HW / x * 100,6)
  42.         uptime = round(float(summary['SUMMARY'][0]['Elapsed'] / 60.0 / 60.0),2)
  43.         os.system('cls' if os.name == 'nt' else 'clear')
  44.         found = summary['SUMMARY'][0]['Found Blocks']
  45.         if found == 0:
  46.             message = "Keep Trying!"
  47.         else :
  48.             message = "$$$YAY$$$"
  49.  
  50.         print ""
  51.         print "##########################################################"
  52.         print "#"
  53.         print "#                ANTMINER S1 & S3 STATISTICS"
  54.         print "#"
  55.         print "##########################################################"
  56.         print "#"
  57.         print "# Your current GH/s =    ", "|", speed
  58.         print "# "
  59.         print "# Your Accepted # =      ", "|", ('{:,}'.format(accepted))
  60.         print "# "
  61.         print "# Your rejected % =      ", "|", rejected
  62.         print "# "
  63.         print "# Your current HW% =     ", "|", percent
  64.         print "# "
  65.         print "# Your best share diff = ", "|", ('{:,}'.format(best))
  66.         print "# "
  67.         print "# Your uptime in hours = ", "|", uptime
  68.         print "#"
  69.         print "# Found Blocks Total =   ", "|", found, message
  70.         print "# "
  71.         print "##########################################################"
  72.         print ""
  73.         sleep(int(update))
  74.  
  75. def s7():
  76.        
  77.     loop = 1
  78.    
  79.     while loop == 1:
  80.         summary = cgminer.summary()
  81.        
  82.         HW = float(summary['SUMMARY'][0]['Hardware Errors'])
  83.         diffa = float(summary['SUMMARY'][0]['Difficulty Accepted'])
  84.         diffr = float(summary['SUMMARY'][0]['Difficulty Rejected'])
  85.        
  86.         x = HW + diffa + diffr
  87.  
  88.         speed = summary['SUMMARY'][0]['GHS 5s']
  89.         accepted = summary['SUMMARY'][0]['Accepted']
  90.         best = summary['SUMMARY'][0]['Best Share']
  91.         rejected = round(summary['SUMMARY'][0]['Device Rejected%'],6)
  92.         percent = round(HW / x * 100,6)
  93.         uptime = round(float(summary['SUMMARY'][0]['Elapsed'] / 60.0 / 60.0),2)
  94.         os.system('cls' if os.name == 'nt' else 'clear')
  95.         found = summary['SUMMARY'][0]['Found Blocks']
  96.         if found == 0:
  97.             message = "Keep Trying!"
  98.         else :
  99.             message = "$$$YAY$$$"
  100.        
  101.         print ""
  102.         print "##########################################################"
  103.         print "#"
  104.         print "#                ANTMINER S4 - S7 STATISTICS"
  105.         print "#"
  106.         print "##########################################################"
  107.         print "#"
  108.         print "# Your current TH/s =    ", "|", speed / 1000
  109.         print "# "
  110.         print "# Your Accepted # =      ", "|", ('{:,}'.format(accepted))
  111.         print "# "
  112.         print "# Your rejected % =      ", "|", rejected
  113.         print "# "
  114.         print "# Your current HW% =     ", "|", percent
  115.         print "# "
  116.         print "# Your best share diff = ", "|", ('{:,}'.format(best))
  117.         print "# "
  118.         print "# Your uptime in hours = ", "|", uptime
  119.         print "#"
  120.         print "# Found Blocks Total =   ", "|", found, message
  121.         print "# "
  122.         print "##########################################################"
  123.         print ""
  124.         sleep(int(update))
  125.  
  126. def gaw():
  127.    
  128.     loop = 1
  129.    
  130.     while loop == 1:
  131.         summary = cgminer.summary()
  132.        
  133.         HW = float(summary['SUMMARY'][0]['Hardware Errors'])
  134.         diffa = float(summary['SUMMARY'][0]['Difficulty Accepted'])
  135.         diffr = float(summary['SUMMARY'][0]['Difficulty Rejected'])
  136.        
  137.         x = HW + diffa + diffr
  138.        
  139.         speed = summary['SUMMARY'][0]['MHS 1m']
  140.         accepted = summary['SUMMARY'][0]['Accepted']
  141.         best = summary['SUMMARY'][0]['Best Share']
  142.         rejected = round(summary['SUMMARY'][0]['Device Rejected%'],6)
  143.         percent = round(HW / x * 100,6)
  144.         uptime = round(float(summary['SUMMARY'][0]['Elapsed'] / 60.0 / 60.0),2)
  145.         os.system('cls' if os.name == 'nt' else 'clear')
  146.  
  147.         print ""
  148.         print "##########################################################"
  149.         print "#"
  150.         print "#          GAW FURY or ZEUS BLIZZARD STATISTICS"
  151.         print "#"
  152.         print "##########################################################"
  153.         print "#"
  154.         print "# Your current MH/S =    ", "|", speed
  155.         print "# "
  156.         print "# Your Accepted # =      ", "|", ('{:,}'.format(accepted))
  157.         print "# "
  158.         print "# Your rejected % =      ", "|", rejected
  159.         print "# "
  160.         print "# Your current HW% =     ", "|", percent
  161.         print "# "
  162.         print "# Your best share diff = ", "|", ('{:,}'.format(best))
  163.         print "# "
  164.         print "# Your uptime in hours = ", "|", uptime
  165.         print "# "
  166.         print "##########################################################"
  167.         print ""
  168.  
  169.         sleep(int(update))
  170.  
  171. ##Choose device to modify output (eg. hashrate)
  172. msg3 = "Please Choose Device Type"
  173. x = indexbox(msg3, choices=["Gaw/Zeus","Antminer S1 or s3","Antminer s4-s7"])
  174.  
  175. ##Display correct data based on device type
  176. if x == 1:
  177.     antminer()
  178. elif x == 0:
  179.     gaw()
  180. elif x == 2:
  181.     s7()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement