diff --git a/licenses/BSL.txt b/licenses/BSL.txt new file mode 100644 index 0000000000..36b7cd93cd --- /dev/null +++ b/licenses/BSL.txt @@ -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. diff --git a/packages/addons/addon-depends/snapcast-depends/aixlog/package.mk b/packages/addons/addon-depends/snapcast-depends/aixlog/package.mk new file mode 100644 index 0000000000..ad78669036 --- /dev/null +++ b/packages/addons/addon-depends/snapcast-depends/aixlog/package.mk @@ -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 . +################################################################################ + +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" diff --git a/packages/addons/addon-depends/snapcast-depends/asio/package.mk b/packages/addons/addon-depends/snapcast-depends/asio/package.mk new file mode 100644 index 0000000000..51910b1b84 --- /dev/null +++ b/packages/addons/addon-depends/snapcast-depends/asio/package.mk @@ -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 . +################################################################################ + +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" diff --git a/packages/addons/addon-depends/snapcast-depends/popl/package.mk b/packages/addons/addon-depends/snapcast-depends/popl/package.mk new file mode 100644 index 0000000000..94b7b3a6a5 --- /dev/null +++ b/packages/addons/addon-depends/snapcast-depends/popl/package.mk @@ -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 . +################################################################################ + +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" diff --git a/packages/addons/addon-depends/snapcast-depends/shairport-sync/package.mk b/packages/addons/addon-depends/snapcast-depends/shairport-sync/package.mk new file mode 100644 index 0000000000..7cdda664df --- /dev/null +++ b/packages/addons/addon-depends/snapcast-depends/shairport-sync/package.mk @@ -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 . +################################################################################ + +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() { + : +} diff --git a/packages/addons/addon-depends/snapcast-depends/snapcast/package.mk b/packages/addons/addon-depends/snapcast-depends/snapcast/package.mk new file mode 100644 index 0000000000..9450daf35c --- /dev/null +++ b/packages/addons/addon-depends/snapcast-depends/snapcast/package.mk @@ -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 . +################################################################################ + +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() { + : +} diff --git a/packages/addons/addon-depends/snapcast-depends/snapcast/patches/snapcast-01_makefiles.patch b/packages/addons/addon-depends/snapcast-depends/snapcast/patches/snapcast-01_makefiles.patch new file mode 100644 index 0000000000..e9fada239e --- /dev/null +++ b/packages/addons/addon-depends/snapcast-depends/snapcast/patches/snapcast-01_makefiles.patch @@ -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 diff --git a/packages/addons/service/snapclient/changelog.txt b/packages/addons/service/snapclient/changelog.txt new file mode 100644 index 0000000000..ffbebe8438 --- /dev/null +++ b/packages/addons/service/snapclient/changelog.txt @@ -0,0 +1,2 @@ +100 +- Initial addon diff --git a/packages/addons/service/snapclient/icon/icon.png b/packages/addons/service/snapclient/icon/icon.png new file mode 100644 index 0000000000..b764a02395 Binary files /dev/null and b/packages/addons/service/snapclient/icon/icon.png differ diff --git a/packages/addons/service/snapclient/package.mk b/packages/addons/service/snapclient/package.mk new file mode 100644 index 0000000000..e4b9500e7e --- /dev/null +++ b/packages/addons/service/snapclient/package.mk @@ -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 . +################################################################################ + +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" +} diff --git a/packages/addons/service/snapclient/source/addon.py b/packages/addons/service/snapclient/source/addon.py new file mode 100644 index 0000000000..4775b5397b --- /dev/null +++ b/packages/addons/service/snapclient/source/addon.py @@ -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 . +################################################################################ + +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 diff --git a/packages/addons/service/snapclient/source/bin/snapclient.start b/packages/addons/service/snapclient/source/bin/snapclient.start new file mode 100644 index 0000000000..5901fb9295 --- /dev/null +++ b/packages/addons/service/snapclient/source/bin/snapclient.start @@ -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 . +################################################################################ + +. /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 diff --git a/packages/addons/service/snapclient/source/default.py b/packages/addons/service/snapclient/source/default.py new file mode 100644 index 0000000000..bfdd4981a5 --- /dev/null +++ b/packages/addons/service/snapclient/source/default.py @@ -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 . +################################################################################ + +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() diff --git a/packages/addons/service/snapclient/source/resources/language/English/strings.po b/packages/addons/service/snapclient/source/resources/language/English/strings.po new file mode 100644 index 0000000000..12eb6aa994 --- /dev/null +++ b/packages/addons/service/snapclient/source/resources/language/English/strings.po @@ -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 "" diff --git a/packages/addons/service/snapclient/source/resources/settings.xml b/packages/addons/service/snapclient/source/resources/settings.xml new file mode 100644 index 0000000000..fdbdf00ddf --- /dev/null +++ b/packages/addons/service/snapclient/source/resources/settings.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/packages/addons/service/snapclient/source/settings-default.xml b/packages/addons/service/snapclient/source/settings-default.xml new file mode 100644 index 0000000000..77fb284747 --- /dev/null +++ b/packages/addons/service/snapclient/source/settings-default.xml @@ -0,0 +1,10 @@ + + false + + false + 0 + -3 + 1704 + 0 + + diff --git a/packages/addons/service/snapclient/source/system.d/service.snapclient.service b/packages/addons/service/snapclient/source/system.d/service.snapclient.service new file mode 100644 index 0000000000..3d472614c6 --- /dev/null +++ b/packages/addons/service/snapclient/source/system.d/service.snapclient.service @@ -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 diff --git a/packages/addons/service/snapserver/changelog.txt b/packages/addons/service/snapserver/changelog.txt new file mode 100644 index 0000000000..ffbebe8438 --- /dev/null +++ b/packages/addons/service/snapserver/changelog.txt @@ -0,0 +1,2 @@ +100 +- Initial addon diff --git a/packages/addons/service/snapserver/icon/icon.png b/packages/addons/service/snapserver/icon/icon.png new file mode 100644 index 0000000000..6bf0f85a1a Binary files /dev/null and b/packages/addons/service/snapserver/icon/icon.png differ diff --git a/packages/addons/service/snapserver/package.mk b/packages/addons/service/snapserver/package.mk new file mode 100644 index 0000000000..674dabf750 --- /dev/null +++ b/packages/addons/service/snapserver/package.mk @@ -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 . +################################################################################ + +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" +} diff --git a/packages/addons/service/snapserver/source/bin/snapserver.start b/packages/addons/service/snapserver/source/bin/snapserver.start new file mode 100644 index 0000000000..3cc71a6609 --- /dev/null +++ b/packages/addons/service/snapserver/source/bin/snapserver.start @@ -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 . +################################################################################ + +. /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 diff --git a/packages/addons/service/snapserver/source/default.py b/packages/addons/service/snapserver/source/default.py new file mode 100644 index 0000000000..a4ba4d9ce1 --- /dev/null +++ b/packages/addons/service/snapserver/source/default.py @@ -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 . +################################################################################ + +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() diff --git a/packages/addons/service/snapserver/source/resources/language/English/strings.po b/packages/addons/service/snapserver/source/resources/language/English/strings.po new file mode 100644 index 0000000000..2ee26e3825 --- /dev/null +++ b/packages/addons/service/snapserver/source/resources/language/English/strings.po @@ -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 "" diff --git a/packages/addons/service/snapserver/source/resources/settings.xml b/packages/addons/service/snapserver/source/resources/settings.xml new file mode 100644 index 0000000000..2a1ea8583a --- /dev/null +++ b/packages/addons/service/snapserver/source/resources/settings.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/addons/service/snapserver/source/settings-default.xml b/packages/addons/service/snapserver/source/settings-default.xml new file mode 100644 index 0000000000..1876e660ca --- /dev/null +++ b/packages/addons/service/snapserver/source/settings-default.xml @@ -0,0 +1,7 @@ + + 1705 + 0 + Airplay + 1704 + --stream pipe:///tmp/snapfifo?name=default + diff --git a/packages/addons/service/snapserver/source/system.d/service.snapserver.service b/packages/addons/service/snapserver/source/system.d/service.snapserver.service new file mode 100644 index 0000000000..09232a23f5 --- /dev/null +++ b/packages/addons/service/snapserver/source/system.d/service.snapserver.service @@ -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