Skip to content

Commit

Permalink
Merge branch 'quiet' of git://github.com/gominoa/poclbm
Browse files Browse the repository at this point in the history
  • Loading branch information
m0mchil committed Jul 9, 2011
2 parents 6c73ccc + 88eb0db commit d8342e7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions BitcoinMiner.py
Expand Up @@ -152,7 +152,8 @@ def __init__(self, device, options):
self.setpool(self.servers[0])
self.user_servers = list(self.servers)

def say(self, format, args=()):
def say(self, format, args=(), sayQuiet=False):
if self.options.quiet and not sayQuiet: return
with self.outputLock:
p = format % args
pool = self.pool[4]+' ' if self.pool else ''
Expand All @@ -166,6 +167,9 @@ def sayLine(self, format, args=()):
if not self.options.verbose:
format = '%s, %s\n' % (datetime.now().strftime(TIME_FORMAT), format)
self.say(format, args)

def sayQuiet(self, format, args=()):
self.say(format, args, True)

def exit(self):
self.stop = True
Expand All @@ -175,7 +179,7 @@ def sayStatus(self, rate, estRate):
estRate = Decimal(estRate) / 1000
totShares = self.shareCount[1] + self.shareCount[0]
totSharesE = max(totShares, totShares, 1)
self.say('[%.03f MH/s (~%d MH/s)] [Rej: %d/%d (%d%%)]', (rate, round(estRate), self.shareCount[0], totShares, self.shareCount[0] * 100 / totSharesE))
self.sayQuiet('[%.03f MH/s (~%d MH/s)] [Rej: %d/%d (%d%%)]', (rate, round(estRate), self.shareCount[0], totShares, self.shareCount[0] * 100 / totSharesE))

def failure(self, message):
print '\n%s' % message
Expand Down
1 change: 1 addition & 0 deletions README.mkd
Expand Up @@ -6,6 +6,7 @@ Options:
--version show program's version number and exit
-h, --help show this help message and exit
--verbose verbose output, suitable for redirection to log file
-q, --quiet suppress all output except hash rate display

Miner Options:
-r RATE, --rate=RATE
Expand Down
1 change: 1 addition & 0 deletions poclbm.py
Expand Up @@ -9,6 +9,7 @@
usage = "usage: %prog [OPTION]... SERVER[#tag]...\nSERVER is one or more [http[s]://]user:pass@host:port (required)\n[#tag] is a per SERVER user friendly name displayed in stats (optional)"
parser = OptionParser(version=USER_AGENT, usage=usage)
parser.add_option('--verbose', dest='verbose', action='store_true', help='verbose output, suitable for redirection to log file')
parser.add_option('-q', '--quiet', dest='quiet', action='store_true', help='suppress all output except hash rate display')

group = OptionGroup(parser, "Miner Options")
group.add_option('-r', '--rate', dest='rate', default=1, help='hash rate display interval in seconds, default=1', type='float')
Expand Down

0 comments on commit d8342e7

Please sign in to comment.