From: Guillaume Pellerin Date: Wed, 24 Nov 2021 16:41:06 +0000 (+0100) Subject: add eno type interfaces, fix psutil parsing X-Git-Tag: 0.9~1^2^2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=93ed0164b943ff94198d39049058362889f18eb6;p=telecaster-client.git add eno type interfaces, fix psutil parsing --- diff --git a/telecaster/tools/status.py b/telecaster/tools/status.py index c646c75..f82a3a3 100644 --- a/telecaster/tools/status.py +++ b/telecaster/tools/status.py @@ -42,7 +42,8 @@ from django.conf import settings class Status(object): interfaces = ['eth0', 'eth1', 'eth2', 'eth0-eth2', 'eth3', 'eth4', - 'wlan0', 'wlan1', 'wlan2', 'wlan3', 'wlan4'] + 'wlan0', 'wlan1', 'wlan2', 'wlan3', 'wlan4', 'eno0', + 'eno1',] acpi_states = {0: 'battery', 1: 'battery', 2: 'AC'} def __init__(self): @@ -109,8 +110,8 @@ class Status(object): def get_ids(self): self.jacking = get_pid('jackd', args=False) != None - self.audio_encoding = get_pid('gst-launch-0.10', args='lamemp3enc') != None - self.video_encoding = get_pid('gst-launch-0.10', args='vp8enc') != None + self.audio_encoding = get_pid('gst-launch-1.0', args='lamemp3enc') != None + self.video_encoding = get_pid('gst-launch-1.0', args='vp8enc') != None self.audio_monitoring = get_pid('deefuzzer', args=self.mp3_monitoring_conf) != None self.video_monitoring = get_pid('deefuzzer', args=self.webm_monitoring_conf) != None diff --git a/telecaster/tools/tools.py b/telecaster/tools/tools.py index b096829..487d9ff 100644 --- a/telecaster/tools/tools.py +++ b/telecaster/tools/tools.py @@ -106,10 +106,10 @@ def xml2dict(conf_file): def get_pid(name, args=None): """Get a process pid filtered by arguments and uid""" for proc in psutil.process_iter(): - if proc.cmdline: - if name == proc.name: + if proc.cmdline(): + if name == proc.name(): if args: - if args in proc.cmdline[1:]: + if args in proc.cmdline()[1:]: return proc.pid else: return proc.pid