Added --nocolor option to hw-sensors
* Going to use it to export the "final" temps before killing Prime95
This commit is contained in:
parent
03d7646685
commit
c1fe3d8538
1 changed files with 13 additions and 4 deletions
|
|
@ -49,10 +49,10 @@ def color_temp(temp):
|
||||||
color = COLORS['BLUE']
|
color = COLORS['BLUE']
|
||||||
else:
|
else:
|
||||||
color = COLORS['CLEAR']
|
color = COLORS['CLEAR']
|
||||||
return '{color}{prefix}{temp:2}°C{CLEAR}'.format(
|
return '{color}{prefix}{temp:2.0f}°C{CLEAR}'.format(
|
||||||
color = color,
|
color = color,
|
||||||
prefix = '+' if temp>0 else '-',
|
prefix = '+' if temp>0 else '-',
|
||||||
temp = int(temp),
|
temp = temp,
|
||||||
**COLORS)
|
**COLORS)
|
||||||
|
|
||||||
def get_feature_string(chip, feature):
|
def get_feature_string(chip, feature):
|
||||||
|
|
@ -74,7 +74,17 @@ def get_feature_string(chip, feature):
|
||||||
if 'alarm' in name:
|
if 'alarm' in name:
|
||||||
# Skip
|
# Skip
|
||||||
continue
|
continue
|
||||||
data[name] = color_temp(val)
|
if '--nocolor' in sys.argv:
|
||||||
|
try:
|
||||||
|
temp = float(val)
|
||||||
|
except ValueError:
|
||||||
|
data[name] = ' {}°C'.format(val)
|
||||||
|
else:
|
||||||
|
data[name] = '{}{:2.0f}°C'.format(
|
||||||
|
'+' if temp>0 else '-',
|
||||||
|
temp)
|
||||||
|
else:
|
||||||
|
data[name] = color_temp(val)
|
||||||
|
|
||||||
main_temp = data.pop('input', None)
|
main_temp = data.pop('input', None)
|
||||||
if main_temp:
|
if main_temp:
|
||||||
|
|
@ -101,7 +111,6 @@ def join_columns(column1, column2, width=55):
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
# Prep
|
# Prep
|
||||||
clear_screen()
|
|
||||||
sensors.init()
|
sensors.init()
|
||||||
|
|
||||||
# Get sensor data
|
# Get sensor data
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue