Kodi Community Forum

Full Version: [RELEASE] Bluetooth Delay
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Bluetooth Delay for Kodi
script.bluetooth.delay

This addon makes it easy to use Kodi with bluetooth headphones.

With this addon you can set up audio delay for one or two devices, and toggle between them via a shortcut on your home screen, or a shortcut on your keyboard.

You can download and install the repo from here or install via 'Add Source' with this URL https://mar-official.github.io

To set a keyboard shortcut:
For toggle:       RunScript(script.bluetooth.delay)
For speakers:  RunScript(script.bluetooth.delay,0)
For bluetooth: RunScript(script.bluetooth.delay,1)

Image

Image
This looks great, I will try as I just bought a bluetooth headset and I was shocked about the delay it introduces.
Hm, is it possible to toggle between devices using JSON RPC? As far as I know it is not allowed to use RunScript via JSON RPC:
https://forum.kodi.tv/showthread.php?tid=178881
@devkid 
RunScript is for keyboard.xml file.
Also, for a smartphone, it is possible to toggle by clicking on the shortcut on the home page, as in the picture above.

For the Yatse app, you can use JSON RPC:

Addons.ExecuteAddon
{"addonid": "script.bluetooth.delay"}
Image
I patched the addon to accept external delay values as provided by JSON RPC calls using ExecuteAddon so it can be remote controlled. If you are interested in that I can send a PR if the source code is available on GitHub.
(2022-02-04, 00:02)devkid Wrote: [ -> ]I patched the addon to accept external delay values as provided by JSON RPC calls using ExecuteAddon so it can be remote controlled. If you are interested in that I can send a PR if the source code is available on GitHub.
I did not understand exactly what you mean "accept external delay values".
Anyway, I'd be happy if you post PR here.
Thanks
Am I right that this addon does not work for all skins? I am having trouble on my Kodi using Aeon MQ8 and I think that those used IDs might be skin dependent and Aeon MQ8 might be using different IDs?
            xbmc.executebuiltin('SetFocus(-73)')
            xbmc.executebuiltin("Action(select)")
            xbmc.executebuiltin('SetFocus(11)')
            xbmc.executebuiltin("Action(select)", wait=True)
            time.sleep(s)
            xbmc.executebuiltin("Action(close)", wait=True)
(2022-02-06, 20:06)vip. Wrote: [ -> ]
(2022-02-04, 00:02)devkid Wrote: [ -> ]I patched the addon to accept external delay values as provided by JSON RPC calls using ExecuteAddon so it can be remote controlled. If you are interested in that I can send a PR if the source code is available on GitHub.
I did not understand exactly what you mean "accept external delay values".

The idea is to let the user configure custom values (that differ from the two configured values) by passing it in a JSON RPC request:
curl -s --data-binary '{ "jsonrpc": "2.0", "method": "Addons.ExecuteAddon", "params": { "wait": false, "addonid": "script.bluetooth.delay", "params": { "delay": "-340"} }, "id": 2 }' -H 'content-type:application/json;' http://192.168.1.1:8080/jsonrpc
Note the "delay" parameter in the request.

So the addon could be fully remote controlled.
(2022-02-08, 09:53)devkid Wrote: [ -> ]Am I right that this addon does not work for all skins? I am having trouble on my Kodi using Aeon MQ8 and I think that those used IDs might be skin dependent and Aeon MQ8 might be using different IDs?
Yes you are right. The Aeon MQ8 should have 'SetFocus(-74)' instead of -73.
I preferred to use SetFocus rather than send 'Action(Down)', because then I need extra sleep and also because of the option of "audio stream" that sometimes the button is grayed out.
I will probably need to add an exception for the Aeon MQ8 with the appropriate SetFocus.
Thanks
(2022-02-08, 10:34)devkid Wrote: [ -> ]The idea is to let the user configure custom values (that differ from the two configured values) by passing it in a JSON RPC request
If you mean "one-time" value, even now you can, by pressing A, then with the right/left arrows change the delay.
Are you interested in the remote feature? It's totally fine if you are not but then I can save the work to add it and send a PR.
(2022-02-08, 09:53)devkid Wrote: [ -> ]I am having trouble on my Kodi using Aeon MQ8 
Now (version 1.1.0) it should work with these skins:
-Ace 2
-Aeon MQ 8
-Aeon Nox: SILVO
-Aeon Tajo
-fTV
-Madnox
-Pellucid
-Quartz
-Xperience1080
-Mimic LR

Thank you
(2022-02-08, 19:44)devkid Wrote: [ -> ]Are you interested in the remote feature? It's totally fine if you are not but then I can save the work to add it and send a PR.
Yes, I want to try it, if you can send.
Thanks for the fix for Aeon and the other skins.

I have my remote control feature here and will test/use it as that:
https://github.com/verybadsoldier/script...te_control

Since the original addon comes with quite some code duplications I created some functions that should be possible to reuse later at other parts in the code to reduce duplications.
Nice.
Missing reset (lines 217-243) for after using the mouse then the stepLength changes.
Pages: 1 2