Make hddtemp module python3 compatible (issue #272)

pull/277/merge
Alessio Sergi 2013-08-12 02:00:00 +02:00
parent d235d4aee2
commit 8dcb6d6e45
1 changed files with 4 additions and 7 deletions

View File

@ -889,7 +889,6 @@ class glancesGrabHDDTemp:
"""
Get hddtemp stats using a socket connection
"""
cache = ""
address = "127.0.0.1"
port = 7634
@ -898,7 +897,6 @@ class glancesGrabHDDTemp:
"""
Init hddtemp stats
"""
try:
sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sck.connect((self.address, self.port))
@ -912,7 +910,6 @@ class glancesGrabHDDTemp:
"""
Update the stats
"""
# Reset the list
self.hddtemp_list = []
@ -938,8 +935,8 @@ class glancesGrabHDDTemp:
else:
data = self.cache
self.cache = data
fields = data.split("|")
devices = (len(fields) - 1) / 5
fields = data.decode('utf-8').split("|")
devices = (len(fields) - 1) // 5
for i in range(0, devices):
offset = i * 5
hddtemp_current = {}
@ -949,10 +946,10 @@ class glancesGrabHDDTemp:
hddtemp_current['value'] = 0
elif temperature == "SLP":
hddtemp_current['label'] = fields[offset + 1].split("/")[-1] + " is sleeping"
hddtemp_current['value'] = 0
hddtemp_current['value'] = 0
elif temperature == "UNK":
hddtemp_current['label'] = fields[offset + 1].split("/")[-1] + " is unknown"
hddtemp_current['value'] = 0
hddtemp_current['value'] = 0
else:
hddtemp_current['label'] = fields[offset + 1].split("/")[-1]
try: