Merge pull request #2619 from awiouy/82-snapclient

snapcast: add streaming from kodi (backport of #2597)
This commit is contained in:
Christian Hewitt 2018-03-27 22:36:31 +05:30 committed by GitHub
commit 7fd53f39c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 62 additions and 26 deletions

View File

@ -1,2 +1,7 @@
101
- Always restart service
- Improve latency setting
- Keep daemon state
100
- Initial addon

View File

@ -18,7 +18,7 @@
PKG_NAME="snapclient"
PKG_VERSION="0.13.0"
PKG_REV="100"
PKG_REV="101"
PKG_ARCH="any"
PKG_LICENSE="GPLv3"
PKG_DEPENDS_TARGET="toolchain snapcast"

View File

@ -43,9 +43,11 @@ esac
[ -n "$sc_h" ] && sc_H="--hostID $sc_h"
[ -n "$sc_s" ] && sc_S="--soundcard $sc_s"
HOME="$ADDON_HOME" \
nice -n "$sc_n" \
snapclient \
--daemon "$sc_n" \
$sc_H \
--latency "$sc_l" \
--port "$sc_p" \
$sc_S
$sc_S \
> /dev/null

View File

@ -6,7 +6,7 @@
<setting label="30003" type="text" id="sc_h" default=""/>
<setting label="30004" type="number" id="sc_p" default="1704"/>
<setting label="30005" type="slider" id="sc_n" default="-3" range="-20,1,19" option="int"/>
<setting label="30006" type="slider" id="sc_l" default="0" range="0,1,100" option="int"/>
<setting label="30006" type="number" id="sc_l" default="0"/>
</category>
<category label="30007">
<setting label="30008" type="bool" id="sc_k" default="false"/>

View File

@ -4,8 +4,8 @@ After=kodi.service network-online.target sound.target
Requires=kodi.service network-online.target sound.target
[Service]
Type=forking
ExecStart=/bin/sh /storage/.kodi/addons/service.snapclient/bin/snapclient.start
Restart=always
[Install]
WantedBy=kodi.target

View File

@ -1,2 +1,7 @@
101
- Add streaming from Kodi
- Keep daemon state
- Rework settings
100
- Initial addon

View File

@ -18,7 +18,7 @@
PKG_NAME="snapserver"
PKG_VERSION="0.13.0"
PKG_REV="100"
PKG_REV="101"
PKG_ARCH="any"
PKG_LICENSE="GPLv3"
PKG_DEPENDS_TARGET="toolchain shairport-sync snapcast"
@ -30,6 +30,7 @@ PKG_AUTORECONF="no"
PKG_IS_ADDON="yes"
PKG_ADDON_NAME="Snapserver"
PKG_ADDON_TYPE="xbmc.service"
PKG_ADDON_REQUIRES="service.librespot:0.0.0"
PKG_MAINTAINER="Anton Voyl (awiouy)"
make_target() {

View File

@ -20,20 +20,43 @@
. /etc/profile
oe_setup_addon service.snapserver
case "$ss_ps" in
config="pulseaudio.conf"
link="/storage/.config/pulse-daemon.conf.d/50-snapserver.conf"
mkdir -p "$(dirname $link)"
ln -sf "$ADDON_HOME/$config" "$link"
if [ ! -e "$ADDON_HOME/$config" ]; then
cp "$ADDON_DIR/config/$config" "$ADDON_HOME"
fi
file="/tmp/snapkodi"
sink_name="Snapserver"
if [ -z "$(pactl list short | grep $sink_name)" ]; then
pactl load-module module-pipe-sink \
file="$file" \
rate=48000 \
sink_name="$sink_name" \
sink_properties=device.description="$sink_name"
fi
case "$ss_st" in
Default)
ss_us="--stream pipe:///tmp/snapfifo?name=Default"
stream="pipe:///tmp/snapfifo?name=Default"
;;
Airplay)
ss_us="--stream airplay:///shairport-sync?name=Airplay"
Kodi)
stream="pipe://$file?name=Kodi"
;;
Spotify)
ss_us="--stream spotify:///librespot?name=Spotify"
stream="spotify:///librespot?name=Spotify"
;;
*)
stream="airplay:///shairport-sync?name=AirPlay"
;;
esac
HOME="$ADDON_HOME" \
nice -n "$ss_ni" \
snapserver \
--controlPort "$ss_cp" \
--daemon "$ss_ni" \
--port "$ss_sp" \
$ss_us
--controlPort "$ss_cp" \
--port "$ss_sp" \
--stream "$stream" \
> /dev/null

View File

@ -0,0 +1,6 @@
### Pulseaudio reads this file when it starts-up
### Uncomment or add options if you know what you are doing
#resample-method = soxr-vhq
#default-sample-format = s16le
#default-sample-rate = 48000

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
msgctxt "#30000"
msgid "Snapserver"
msgid "Configuration"
msgstr ""
msgctxt "#30001"
@ -22,9 +22,5 @@ msgid "Priority"
msgstr ""
msgctxt "#30004"
msgid "Preset"
msgstr ""
msgctxt "#30005"
msgid "Stream"
msgstr ""

View File

@ -3,8 +3,7 @@
<category label="30000">
<setting label="30001" type="number" id="ss_sp" default="1704"/>
<setting label="30002" type="number" id="ss_cp" default="1705"/>
<setting label="30003" type="number" id="ss_ni" default="0" range="-20,1,19" option="int"/>
<setting label="30004" type="select" id="ss_ps" values="Default|Airplay|Spotify|User"/>
<setting label="30005" type="text" id="ss_us" default="--stream pipe:///tmp/snapfifo?name=default" visible="eq(-1,User)"/>
<setting label="30003" type="slider" id="ss_ni" default="0" range="-20,1,19" option="int"/>
<setting label="30004" type="select" id="ss_st" values="AirPlay|Default|Kodi|Spotify"/>
</category>
</settings>

View File

@ -1,7 +1,6 @@
<settings>
<setting id="ss_cp" value="1705" />
<setting id="ss_ni" value="0" />
<setting id="ss_ps" value="Airplay" />
<setting id="ss_sp" value="1704" />
<setting id="ss_us" value="--stream pipe:///tmp/snapfifo?name=default" />
<setting id="ss_st" value="AirPlay" />
</settings>

View File

@ -4,8 +4,8 @@ After=kodi.service network-online.target sound.target
Requires=kodi.service network-online.target sound.target
[Service]
Type=forking
ExecStart=/bin/sh /storage/.kodi/addons/service.snapserver/bin/snapserver.start
Restart=always
[Install]
WantedBy=kodi.target