Merge pull request #2551 from awiouy/9.0-snapcast

Snapcast
This commit is contained in:
Christian Hewitt 2018-03-09 17:04:36 +04:00 committed by GitHub
commit 320fe144ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 713 additions and 0 deletions

23
licenses/BSL.txt Normal file
View File

@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,29 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
PKG_NAME="aixlog"
PKG_VERSION="1.1.0"
PKG_SHA256="a32f1e899b2ba4631847f1c89d6f967ef81eeef2fa8efa9a13ffea870e7f06f2"
PKG_ARCH="any"
PKG_LICENSE="MIT"
PKG_SITE="https://github.com/badaix/aixlog"
PKG_URL="https://github.com/badaix/aixlog/archive/v$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain"
PKG_SECTION="tools"
PKG_LONGDESC="Header-only C++ logging library"
PKG_TOOLCHAIN="manual"

View File

@ -0,0 +1,29 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
PKG_NAME="asio"
PKG_VERSION="9229964"
PKG_SHA256="799ca6607cb873bdc3253b0f8a058cb15af9c9fc2c74fd1732f6fe7726d7c200"
PKG_ARCH="any"
PKG_LICENSE="BSL"
PKG_SITE="http://think-async.com/Asio"
PKG_URL="https://github.com/chriskohlhoff/asio/archive/$PKG_VERSION.zip"
PKG_DEPENDS_TARGET="toolchain"
PKG_SECTION="tools"
PKG_LONGDESC="Asio C++ Library"
PKG_TOOLCHAIN="manual"

View File

@ -0,0 +1,29 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
PKG_NAME="popl"
PKG_VERSION="1.0.0"
PKG_SHA256="40453db40d5297cf3d5c0a41472290496fc72e778a398c497df2ae552d6fa500"
PKG_ARCH="any"
PKG_LICENSE="GPLv3"
PKG_SITE="https://github.com/badaix/popl"
PKG_URL="https://github.com/badaix/popl/archive/v$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain"
PKG_SECTION="tools"
PKG_LONGDESC="Header-only C++ program options parser library"
PKG_TOOLCHAIN="manual"

View File

@ -0,0 +1,42 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
PKG_NAME="shairport-sync"
PKG_VERSION="3.1.7"
PKG_ARCH="any"
PKG_LICENSE="OSS"
PKG_SITE="https://github.com/mikebrady/shairport-sync"
PKG_URL="https://github.com/mikebrady/shairport-sync/archive/$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain alsa-lib avahi libconfig libdaemon openssl popt pulseaudio soxr"
PKG_SECTION="tools"
PKG_LONGDESC="AirPlay audio player"
PKG_TOOLCHAIN="autotools"
PKG_CONFIGURE_OPTS_TARGET="--with-alsa \
--with-avahi \
--with-convolution \
--with-metadata \
--with-pa \
--with-pipe \
--with-soxr \
--with-ssl=openssl \
--with-stdout"
makeinstall_target() {
:
}

View File

@ -0,0 +1,42 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
PKG_NAME="snapcast"
PKG_VERSION="0.13.0"
PKG_SHA256="8409cdb20805d945fb243324a20a24b15c418466a2026bcc6a9211a6b32fdfae"
PKG_ARCH="any"
PKG_LICENSE="GPLv3"
PKG_SITE="https://github.com/badaix/snapcast"
PKG_URL="https://github.com/badaix/snapcast/archive/v$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain aixlog alsa-lib asio avahi flac libvorbis popl"
PKG_SECTION="tools"
PKG_LONGDESC="Synchronous multi-room audio player"
PKG_TOOLCHAIN="make"
pre_configure_target() {
cd ..
rm -rf .$TARGET_NAME
CXXFLAGS="$CXXFLAGS -pthread \
-I$(get_build_dir aixlog)/include \
-I$(get_build_dir asio)/asio/include \
-I$(get_build_dir popl)/include"
}
makeinstall_target() {
:
}

View File

@ -0,0 +1,30 @@
diff -Naur snapcast-0.13.0/client/Makefile snapcast-0.13.0.Makefiles/client/Makefile
--- snapcast-0.13.0/client/Makefile 2018-03-04 21:43:32.000000000 +0100
+++ snapcast-0.13.0.Makefiles/client/Makefile 2018-03-05 13:33:36.686709820 +0100
@@ -78,10 +78,8 @@
else
-CXX = g++
-STRIP = strip
CXXFLAGS += -pthread -DHAS_VORBIS -DHAS_ALSA -DHAS_AVAHI -DHAS_DAEMON
-LDFLAGS += -lrt -lasound -lvorbis -lavahi-client -lavahi-common -static-libgcc -static-libstdc++ -latomic
+LDFLAGS += -lrt -lasound -lvorbis -lavahi-client -lavahi-common -logg
OBJ += ../common/daemon.o player/alsaPlayer.o browseZeroConf/browseAvahi.o
endif
diff -Naur snapcast-0.13.0/server/Makefile snapcast-0.13.0.Makefiles/server/Makefile
--- snapcast-0.13.0/server/Makefile 2018-03-04 21:43:32.000000000 +0100
+++ snapcast-0.13.0.Makefiles/server/Makefile 2018-03-05 13:34:03.530858350 +0100
@@ -84,10 +84,8 @@
else
-CXX = g++
-STRIP = strip
CXXFLAGS += -DHAS_AVAHI -DHAS_DAEMON -pthread
-LDFLAGS = -lrt -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common -static-libgcc -static-libstdc++
+LDFLAGS = -lrt -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common
OBJ += ../common/daemon.o publishZeroConf/publishAvahi.o
endif

View File

@ -0,0 +1,2 @@
100
- Initial addon

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -0,0 +1,39 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
PKG_NAME="snapclient"
PKG_VERSION="0.13.0"
PKG_REV="100"
PKG_ARCH="any"
PKG_LICENSE="GPLv3"
PKG_DEPENDS_TARGET="toolchain snapcast"
PKG_SECTION="service"
PKG_SHORTDESC="Snapclient: Synchronous multi-room audio client"
PKG_LONGDESC="Snapclient ($PKG_VERSION) is a Snapcast client. Snapcast is a multi-room client-server audio system, where all clients are time synchronized with the server to play perfectly synced audioplays."
PKG_TOOLCHAIN="manual"
PKG_IS_ADDON="yes"
PKG_ADDON_NAME="Snapclient"
PKG_ADDON_TYPE="xbmc.service.library"
PKG_MAINTAINER="Anton Voyl (awiouy)"
addon() {
mkdir -p "$ADDON_BUILD/$PKG_ADDON_ID/bin"
cp "$(get_build_dir snapcast)/client/snapclient" \
"$ADDON_BUILD/$PKG_ADDON_ID/bin"
}

View File

@ -0,0 +1,40 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
import os.path
import subprocess
import xbmcaddon
import xbmcgui
SNAPCLIENT = os.path.join(
xbmcaddon.Addon().getAddonInfo('path'), 'bin', 'snapclient')
card = ''
cards = []
lines = subprocess.check_output([SNAPCLIENT, '--list']).splitlines()
for line in lines:
if line != '':
card = card + ' ' + line
else:
cards.append(card)
card = ''
dialog = xbmcgui.Dialog()
dialog.select(xbmcaddon.Addon().getLocalizedString(30015), cards)
del dialog

View File

@ -0,0 +1,51 @@
#!/bin/sh
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
. /etc/profile
oe_setup_addon service.snapclient
. /etc/os-release
case "$LIBREELEC_ARCH" in
RPi*.arm)
if [ "$sc_a" == "true" ]; then
ALSA="/proc/asound/ALSA"
if [ ! -e "$ALSA" ]; then
echo "Starting Raspberry Pi onboard audio"
dtparam audio=on
sleep 1
fi
if [ -e "$ALSA" ]; then
echo "Setting Raspberry Pi onboard audio playback route"
index="$(readlink $ALSA)"
index="${index##*card}"
amixer -c "$index" cset name="PCM Playback Route" "$sc_r"
fi
fi
;;
esac
[ -n "$sc_h" ] && sc_H="--hostID $sc_h"
[ -n "$sc_s" ] && sc_S="--soundcard $sc_s"
snapclient \
--daemon "$sc_n" \
$sc_H \
--latency "$sc_l" \
--port "$sc_p" \
$sc_S

View File

@ -0,0 +1,70 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
import subprocess
import xbmc
import xbmcaddon
def systemctl(command):
subprocess.call(
['systemctl', command, xbmcaddon.Addon().getAddonInfo('id')])
class Monitor(xbmc.Monitor):
def __init__(self, *args, **kwargs):
xbmc.Monitor.__init__(self)
self.player = Player()
def onSettingsChanged(self):
self.player.start('restart')
class Player(xbmc.Player):
def __init__(self):
super(Player, self).__init__(self)
self.start('start')
def onPlayBackEnded(self):
if xbmcaddon.Addon().getSetting('sc_k') == 'true':
xbmc.sleep(500)
if not self.isPlaying():
systemctl('start')
def onPlayBackStarted(self):
if xbmcaddon.Addon().getSetting('sc_k') == 'true':
systemctl('stop')
def onPlayBackStopped(self):
if xbmcaddon.Addon().getSetting('sc_k') == 'true':
systemctl('start')
def start(self, command):
if xbmcaddon.Addon().getSetting('sc_k') == 'true':
if self.isPlaying():
systemctl('stop')
else:
systemctl(command)
else:
systemctl(command)
if __name__ == '__main__':
Monitor().waitForAbort()

View File

@ -0,0 +1,70 @@
# Kodi Media Center language file
# Addon Name: snapclient
# Addon id: service.snapclient
# Addon Provider: Team LibreELEC
msgid ""
msgstr ""
msgctxt "#30000"
msgid "Snapclient"
msgstr ""
msgctxt "#30001"
msgid "List sound cards"
msgstr ""
msgctxt "#30002"
msgid "Sound card"
msgstr ""
msgctxt "#30003"
msgid "Host ID"
msgstr ""
msgctxt "#30004"
msgid "Port"
msgstr ""
msgctxt "#30005"
msgid "Priority"
msgstr ""
msgctxt "#30006"
msgid "Latency"
msgstr ""
msgctxt "#30007"
msgid "Kodi"
msgstr ""
msgctxt "#30008"
msgid "Stop Snapclient when Kodi plays"
msgstr ""
msgctxt "#30009"
msgid "Rasperry Pi"
msgstr ""
msgctxt "#30010"
msgid "Manage onboard audio"
msgstr ""
msgctxt "#30011"
msgid "Onboard audio playback route"
msgstr ""
msgctxt "#30012"
msgid "Autodetect"
msgstr ""
msgctxt "#30013"
msgid "Jack"
msgstr ""
msgctxt "#30014"
msgid "HDMI"
msgstr ""
msgctxt "#30015"
msgid "Available sound cards"
msgstr ""

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<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="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"/>
</category>
<category label="30007">
<setting label="30008" type="bool" id="sc_k" default="false"/>
</category>
<category label="30009">
<setting label="30010" type="bool" id="sc_a" default="false"/>
<setting label="30011" type="enum" id="sc_r" lvalues="30012|30013|30014" visible="eq(-1,true)"/>
</category>
</settings>

View File

@ -0,0 +1,10 @@
<settings version="2">
<setting id="sc_a" default="true">false</setting>
<setting id="sc_h" default="true"></setting>
<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_p" default="true">1704</setting>
<setting id="sc_r" default="true">0</setting>
<setting id="sc_s" default="true"></setting>
</settings>

View File

@ -0,0 +1,11 @@
[Unit]
Description=Snapclient
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
[Install]
WantedBy=kodi.target

View File

@ -0,0 +1,2 @@
100
- Initial addon

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -0,0 +1,40 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
PKG_NAME="snapserver"
PKG_VERSION="0.13.0"
PKG_REV="100"
PKG_ARCH="any"
PKG_LICENSE="GPLv3"
PKG_DEPENDS_TARGET="toolchain shairport-sync snapcast"
PKG_SECTION="service"
PKG_SHORTDESC="Snapserver: Synchronous multi-room audio server"
PKG_LONGDESC="Snapclient ($PKG_VERSION) is a Snapcast server. Snapcast is a multi-room client-server audio system, where all clients are time synchronized with the server to play perfectly synced audioplays."
PKG_TOOLCHAIN="manual"
PKG_IS_ADDON="yes"
PKG_ADDON_NAME="Snapserver"
PKG_ADDON_TYPE="xbmc.service"
PKG_MAINTAINER="Anton Voyl (awiouy)"
addon() {
mkdir -p "$ADDON_BUILD/$PKG_ADDON_ID/bin"
cp "$(get_build_dir shairport-sync)/.$TARGET_NAME/shairport-sync" \
"$(get_build_dir snapcast)/server/snapserver" \
"$ADDON_BUILD/$PKG_ADDON_ID/bin"
}

View File

@ -0,0 +1,39 @@
#!/bin/sh
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
. /etc/profile
oe_setup_addon service.snapserver
case "$ss_ps" in
Default)
ss_us="--stream pipe:///tmp/snapfifo?name=Default"
;;
Airplay)
ss_us="--stream airplay:///shairport-sync?name=Airplay"
;;
Spotify)
ss_us="--stream spotify:///librespot?name=Spotify"
;;
esac
snapserver \
--controlPort "$ss_cp" \
--daemon "$ss_ni" \
--port "$ss_sp" \
$ss_us

View File

@ -0,0 +1,39 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
import subprocess
import xbmc
import xbmcaddon
def systemctl(command):
subprocess.call(
['systemctl', command, xbmcaddon.Addon().getAddonInfo('id')])
class Monitor(xbmc.Monitor):
def __init__(self, *args, **kwargs):
xbmc.Monitor.__init__(self)
def onSettingsChanged(self):
systemctl('restart')
if __name__ == '__main__':
Monitor().waitForAbort()

View File

@ -0,0 +1,30 @@
# Kodi Media Center language file
# Addon Name: snapserver
# Addon id: service.snapclient
# Addon Provider: Team LibreELEC
msgid ""
msgstr ""
msgctxt "#30000"
msgid "Snapserver"
msgstr ""
msgctxt "#30001"
msgid "Server port"
msgstr ""
msgctxt "#30002"
msgid "Control port"
msgstr ""
msgctxt "#30003"
msgid "Priority"
msgstr ""
msgctxt "#30004"
msgid "Preset"
msgstr ""
msgctxt "#30005"
msgid "Stream"
msgstr ""

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<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)"/>
</category>
</settings>

View File

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

View File

@ -0,0 +1,11 @@
[Unit]
Description=Snapserver
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
[Install]
WantedBy=kodi.target