Merge pull request #5290 from EvTheFuture/addon-snapclient-type-fix

snapclient: Fixed incompatible types when listing sound cards and added --host support
This commit is contained in:
mglae 2021-04-04 19:07:45 +02:00 committed by GitHub
commit b2ecb263a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 3 deletions

View File

@ -1,3 +1,7 @@
106
- Fixed issue when listing sound cards
- Added the option to specify the snapcast server host address
105
- aixlog: update to 1.5.0
- snapcast: update to 0.24.0

View File

@ -3,7 +3,7 @@
PKG_NAME="snapclient"
PKG_VERSION="0.24.0"
PKG_REV="105"
PKG_REV="106"
PKG_ARCH="any"
PKG_LICENSE="GPLv3"
PKG_DEPENDS_TARGET="toolchain alsa-plugins snapcast"

View File

@ -9,9 +9,10 @@ import xbmcgui
SNAPCLIENT = os.path.join(
xbmcaddon.Addon().getAddonInfo('path'), 'bin', 'snapclient')
line = ''
card = ''
cards = []
lines = subprocess.check_output([SNAPCLIENT, '--list']).splitlines()
lines = subprocess.run([SNAPCLIENT, '--list'], capture_output=True, text=True).stdout.splitlines()
for line in lines:
if line != '':
@ -20,6 +21,10 @@ for line in lines:
cards.append(card)
card = ''
# If last line was not empty, make sure to add the last card
if line != '' and card != '':
cards.append(card)
dialog = xbmcgui.Dialog()
dialog.select(xbmcaddon.Addon().getLocalizedString(30015), cards)
del dialog

View File

@ -28,12 +28,14 @@ esac
[ -n "$sc_h" ] && sc_H="--hostID $sc_h"
[ -n "$sc_s" ] && sc_S="--soundcard $sc_s"
[ -n "$sc_addr" ] && HOST="--host $sc_addr"
HOME="$ADDON_HOME" \
nice -n "$sc_n" \
snapclient \
$sc_H \
--latency "$sc_l" \
$HOST \
--port "$sc_p" \
$sc_S \
> /dev/null

View File

@ -68,3 +68,7 @@ msgstr ""
msgctxt "#30015"
msgid "Available sound cards"
msgstr ""
msgctxt "#30016"
msgid "Server"
msgstr ""

View File

@ -3,8 +3,9 @@
<category label="30000">
<setting label="30001" type="action" action="RunAddon(service.snapclient)"/>
<setting label="30002" type="text" id="sc_s" default=""/>
<setting label="30003" type="text" id="sc_h" default=""/>
<setting label="30016" type="text" id="sc_addr" default=""/>
<setting label="30004" type="number" id="sc_p" default="1704"/>
<setting label="30003" type="text" id="sc_h" default=""/>
<setting label="30005" type="slider" id="sc_n" default="-3" range="-20,1,19" option="int"/>
<setting label="30006" type="number" id="sc_l" default="0"/>
</category>

View File

@ -4,6 +4,7 @@
<setting id="sc_k" default="true">false</setting>
<setting id="sc_l" default="true">0</setting>
<setting id="sc_n" default="true">-3</setting>
<setting id="sc_addr" default="true"></setting>
<setting id="sc_p" default="true">1704</setting>
<setting id="sc_r" default="true">0</setting>
<setting id="sc_s" default="true"></setting>