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
[plugin.program.bluetoothctl] 1.0.1 #3912
base: matrix
Are you sure you want to change the base?
Conversation
Why not just use the bluez dbus API instead of calling a binary using subprocess? For an example see how LibreELEC does it. https://github.com/LibreELEC/service.libreelec.settings/blob/master/resources/lib/dbus_bluez.py |
I'm not familiar with D-Bus. I didn't notice bluez had a D-Bus API. It looks like a better long-term solution, although it would mean adding Python D-Bus bindings as a dependency. |
@@ -0,0 +1,386 @@ | |||
from functools import wraps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not good form to have the entire program logic loaded by the file called from the addon.xml (in this case addon.py). That file in never cached, so there is a significant performance hit. Instead, import from a different file and just call it from addon.py.
@@ -0,0 +1,155 @@ | |||
from __future__ import annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the empty init.py file is not needed with Python3 and should be removed. This also applies for the ones in the resources and lib folders.
from __future__ import annotations | ||
from typing import Any | ||
import subprocess | ||
from subprocess import CompletedProcess |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting this from the other comment. Rather than using subprocess and call a binary, you should use the dbus API.
Description
Interact with Bluetooth devices in Kodi using the Linux Bluetooth stack.
Checklist: