From 4eec7dbd5f1838586d14065745cf8d77fca620e4 Mon Sep 17 00:00:00 2001 From: Guill Lo Date: Fri, 22 May 2020 13:42:25 +0800 Subject: [PATCH] add compatibility to bluetoothconnecter 2.0.0 --- src/get_devices.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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):