Just tested incompetent-nerd's post on LE 10.0.0.1 with RPI4, works like a charm for me!
Just added on line in /storage/.config/autostart.sh, so that audio comes from hdmi instead of pulseaudio default stereo output:
And i used os.popen().read() instead of subprocess.check_output() to get a unicode string instead of binary array in
/storage/.kodi/userdata/bluetooth.py:
Code
import os, xbmc
# Perform the below shell command. This assigns the bluetooth device as a default source for Kodi
os.system("pactl set-default-source `pactl list short sources | grep -i blue | awk {'print $2 '}`")
# Assign the output of the shell command to BT_NAME (Bluetooth Name)
BT_NAME = os.popen("pactl list sources | grep -i bluetooth.protocol -A 1 | awk 'FNR==2{print $3}' | tr -d '\n' | tr -d '\"'").read()
# If the variable is not empty, create a KODI dialog showing the name of the bluetooth device.
if BT_NAME:
xbmc.executebuiltin("Notification(Bluetooth, Activated: %s, 3000)" % BT_NAME)
os.system("pactl unload-module module-loopback")
os.system("pactl load-module module-loopback latency_msec=1000")
# If the variable is empty, creatae a KODI dialog showing no bluetooth device found.
else:
xbmc.executebuiltin("Notification(Bluetooth, No blutooth device found, 3000)")
Display More