diff --git a/src/get_devices.py b/src/get_devices.py index af71eeb..d5a993c 100755 --- a/src/get_devices.py +++ b/src/get_devices.py @@ -4,13 +4,14 @@ import re import json -devicesRaw = os.popen('/bin/bash -c /usr/local/bin/BluetoothConnector').read() +TRUE, pout = os.popen4('/bin/bash -c /usr/local/bin/BluetoothConnector') +devicesRaw = pout.read() deviceMacs = [] deviceNames = [] airPodsPosition = -1 -macsRegex = r"(?!Usage|Get|\n)^\S*" +macsRegex = r"^([0-9A-Fa-f]{2}[-]){5}([0-9A-Fa-f]{2})" macsMatches = re.finditer(macsRegex, devicesRaw, re.MULTILINE) for matchNum, match in enumerate(macsMatches, start=1):