You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
607 B
22 lines
607 B
8 years ago
|
import itertools
|
||
|
import math
|
||
8 years ago
|
|
||
|
def action(command, text, **kwargs):
|
||
|
return '<action=`{}`{}>{}</action>'.format(command,' '+(' '.join(['{}={}'.format(k, v) for k,v in kwargs.items()])) if len(kwargs) else '', text)
|
||
|
|
||
8 years ago
|
def create_bars(volume):
|
||
|
num_bars=float(volume)/9000.0
|
||
|
return ('/'*math.floor(num_bars))+partial_bar(num_bars-math.floor(num_bars))+(' '*(10-math.ceil(num_bars)))
|
||
|
|
||
|
def partial_bar(bar_size):
|
||
|
if bar_size == 0.0:
|
||
|
return ''
|
||
|
elif bar_size < 0.3:
|
||
|
return ' '
|
||
|
elif bar_size < 0.6:
|
||
|
return '.'
|
||
|
elif bar_size < 0.9:
|
||
|
return '-'
|
||
|
return '/'
|
||
|
|