fixed json decoding error, now raises APIError, and sorted IP List same as data list
This commit is contained in:
@@ -71,7 +71,10 @@ class BaseMinerAPI:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
data = json.loads(data.decode('utf-8')[:-1])
|
try:
|
||||||
|
data = json.loads(data.decode('utf-8')[:-1])
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
raise APIError(f"Decode Error: {data}")
|
||||||
|
|
||||||
# close the connection
|
# close the connection
|
||||||
writer.close()
|
writer.close()
|
||||||
|
|||||||
@@ -247,6 +247,9 @@ async def sort_data(index: int or str):
|
|||||||
new_data_list = sorted(new_list, key=lambda x: float(x[indexes[index]]))
|
new_data_list = sorted(new_list, key=lambda x: float(x[indexes[index]]))
|
||||||
else:
|
else:
|
||||||
new_data_list = sorted(new_list, key=itemgetter(indexes[index]))
|
new_data_list = sorted(new_list, key=itemgetter(indexes[index]))
|
||||||
|
new_ip_list = []
|
||||||
|
for item in new_data_list:
|
||||||
|
new_ip_list.append(item[indexes['ip']])
|
||||||
new_data_list = [str(item[indexes['ip']]) + " | "
|
new_data_list = [str(item[indexes['ip']]) + " | "
|
||||||
+ item[1] + " | "
|
+ item[1] + " | "
|
||||||
+ item[indexes['hr']] + " TH/s | "
|
+ item[indexes['hr']] + " TH/s | "
|
||||||
@@ -255,6 +258,7 @@ async def sort_data(index: int or str):
|
|||||||
for item in new_data_list]
|
for item in new_data_list]
|
||||||
window["hr_list"].update(disabled=False)
|
window["hr_list"].update(disabled=False)
|
||||||
window["hr_list"].update(new_data_list)
|
window["hr_list"].update(new_data_list)
|
||||||
|
window['ip_list'].update(new_ip_list)
|
||||||
window["hr_list"].update(disabled=True)
|
window["hr_list"].update(disabled=True)
|
||||||
await update_ui_with_data("status", "")
|
await update_ui_with_data("status", "")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user