snapserver: initial addon

This commit is contained in:
awiouy 2018-03-04 18:54:17 +01:00
parent 1e54f6b690
commit ca20c72f08
9 changed files with 186 additions and 0 deletions

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -0,0 +1,48 @@
################################################################################
# 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_AUTORECONF="no"
PKG_IS_ADDON="yes"
PKG_ADDON_NAME="Snapserver"
PKG_ADDON_TYPE="xbmc.service"
PKG_MAINTAINER="Anton Voyl (awiouy)"
make_target() {
:
}
makeinstall_target() {
:
}
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>
<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" />
</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