Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hddtemp: remove deprecated telnetlib dependency (fixes #2261) #2262

Merged
merged 4 commits into from
Oct 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions py3status/modules/hddtemp.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

Requires:
hddtemp: utility to monitor hard drive temperatures
netcat: (nc) is a command-line utility for reading
data from hddtemp telnet interface

Bible of HDD failures:
Hard disk temperatures higher than 45°C led to higher failure rates.
Expand Down Expand Up @@ -108,7 +110,6 @@
"""

from string import printable
from telnetlib import Telnet


class Py3status:
Expand All @@ -135,7 +136,7 @@ def post_config_hook(self):
self.thresholds_init = self.py3.get_color_names_list(self.format_hdd)

def hddtemp(self):
line = Telnet("localhost", 7634).read_all().decode("utf-8", "ignore")
line = self.py3.command_output("nc localhost 7634")
new_data = []

for chunk in line[1:-1].split("||"):
Expand Down
Loading