mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
chrome: fix getting default audio device
Setting "audiooutput.audiodevice" was not found any more because settings format has be changed to version 2. Read the setting value via Kodi json RPC.
This commit is contained in:
parent
1b2f78956b
commit
c45e2ec159
@ -7,7 +7,7 @@ import sys
|
||||
import time
|
||||
import xbmcaddon
|
||||
import subprocess
|
||||
from xml.dom.minidom import parse
|
||||
import json
|
||||
|
||||
sys.path.append('/usr/share/kodi/addons/service.libreelec.settings')
|
||||
|
||||
@ -59,11 +59,14 @@ def isRuning(pname):
|
||||
return False
|
||||
|
||||
def getAudioDevice():
|
||||
try:
|
||||
dom = parse("/storage/.kodi/userdata/guisettings.xml")
|
||||
audiooutput=dom.getElementsByTagName('audiooutput')
|
||||
for node in audiooutput:
|
||||
dev = node.getElementsByTagName('audiodevice')[0].childNodes[0].nodeValue
|
||||
dev = json.loads(xbmc.executeJSONRPC(json.dumps({
|
||||
"jsonrpc": "2.0",
|
||||
"method": "Settings.GetSettingValue",
|
||||
"params": {
|
||||
"setting": "audiooutput.audiodevice",
|
||||
},
|
||||
"id": 1,
|
||||
})))['result']['value']
|
||||
if dev.startswith("ALSA:"):
|
||||
dev = dev.split("ALSA:")[1]
|
||||
if dev == "@":
|
||||
@ -73,8 +76,6 @@ def getAudioDevice():
|
||||
else:
|
||||
# not ALSA
|
||||
return None
|
||||
except:
|
||||
return None
|
||||
if dev.startswith("CARD="):
|
||||
dev = "plughw:" + dev
|
||||
return dev
|
||||
|
Loading…
x
Reference in New Issue
Block a user