Improper bytes/unicode in glances_hddtemp.py #887

pull/923/head
Nicolargo 2016-09-02 15:25:23 +02:00
parent 97a9365bf8
commit fd9cc986de
2 changed files with 4 additions and 2 deletions

View File

@ -131,7 +131,8 @@ class GlancesGrabHDDTemp(object):
hddtemp_current['value'] = float(temperature) hddtemp_current['value'] = float(temperature)
except ValueError: except ValueError:
# Temperature could be 'ERR', 'SLP' or 'UNK' (see issue #824) # Temperature could be 'ERR', 'SLP' or 'UNK' (see issue #824)
hddtemp_current['value'] = temperature # Improper bytes/unicode in glances_hddtemp.py (see issue #887)
hddtemp_current['value'] = nativestr(temperature)
hddtemp_current['unit'] = unit hddtemp_current['unit'] = unit
self.hddtemp_list.append(hddtemp_current) self.hddtemp_list.append(hddtemp_current)

View File

@ -183,6 +183,7 @@ class Plugin(GlancesPlugin):
ret.append(self.curse_add_line(msg, "TITLE")) ret.append(self.curse_add_line(msg, "TITLE"))
for i in self.stats: for i in self.stats:
logger.info(i)
# Do not display anything if no battery are detected # Do not display anything if no battery are detected
if (i['type'] == 'battery' and i['value'] == []): if (i['type'] == 'battery' and i['value'] == []):
continue continue
@ -197,7 +198,7 @@ class Plugin(GlancesPlugin):
else: else:
msg = '{:13}'.format(label[:13]) msg = '{:13}'.format(label[:13])
ret.append(self.curse_add_line(msg)) ret.append(self.curse_add_line(msg))
if i['value'] in (b'ERR', b'SLP', b'UNK'): if i['value'] in (b'ERR', b'SLP', b'UNK', b'NOS'):
msg = '{:>8}'.format(i['value']) msg = '{:>8}'.format(i['value'])
ret.append(self.curse_add_line( ret.append(self.curse_add_line(
msg, self.get_views(item=i[self.get_key()], msg, self.get_views(item=i[self.get_key()],