Merge pull request #4665 from mglae/le10_chrome_audio

chrome: fix default audio device detection
This commit is contained in:
CvH 2020-11-18 11:12:47 +01:00 committed by GitHub
commit 3e933d404c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 21 deletions

View File

@ -12,7 +12,8 @@ PKG_DEPENDS_TARGET="toolchain atk dbus glib libXtst"
PKG_LONGDESC="Protocol definitions and daemon for D-Bus at-spi."
PKG_MESON_OPTS_TARGET="-Denable_docs=false \
-Denable-introspection=no"
-Denable-introspection=no \
-Ddbus_daemon=/usr/bin/dbus-daemon"
pre_configure_target() {
TARGET_LDFLAGS="$LDFLAGS -lXext"

View File

@ -1,3 +1,6 @@
103
- fix getting default audio device
102
- add dark mode at options
- support for latest Chrome

View File

@ -3,7 +3,7 @@
PKG_NAME="chrome"
PKG_VERSION="1.0"
PKG_REV="102"
PKG_REV="103"
PKG_ARCH="x86_64"
PKG_LICENSE="Custom"
PKG_SITE="http://www.google.com/chrome"

View File

@ -7,11 +7,9 @@ import sys
import time
import xbmcaddon
import subprocess
from xml.dom.minidom import parse
import json
sys.path.append('/usr/share/kodi/addons/@DISTRO_PKG_SETTINGS_ID@')
import oe
import xbmc
__addon__ = xbmcaddon.Addon();
__path__ = os.path.join(__addon__.getAddonInfo('path'), 'bin') + '/'
@ -49,7 +47,7 @@ def startchrome(args):
__addon__.getSetting('HOMEPAGE')
subprocess.call(__path__ + 'chrome-start ' + chrome_params, shell=True, env=new_env)
except Exception as e:
oe.dbg_log('chrome', e)
xbmc.log('## Chrome Error:' + repr(e), xbmc.LOGERROR)
def isRuning(pname):
tmp = os.popen("ps -Af").read()
@ -59,21 +57,22 @@ 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
if dev.startswith("ALSA:"):
dev = dev.split("ALSA:")[1]
if dev == "@":
return None
if dev.startswith("@:"):
dev = dev.split("@:")[1]
else:
# not ALSA
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 == "@":
return None
except:
if dev.startswith("@:"):
dev = dev.split("@:")[1]
else:
# not ALSA
return None
if dev.startswith("CARD="):
dev = "plughw:" + dev
@ -100,3 +99,4 @@ else:
time.sleep(1)
resumeXbmc()
del __addon__