MycroftOS: Addition of Snapcast; Both client and server.

- Configuration opts are in /etc/snapcast/
- Server configuration in /etc/snapcast.conf
- NOT enabled by default, can be started/enabled by;
  sudo systemctl start/enable snapclient.service
  sudo systemctl start/emable snapserver.service
This commit is contained in:
Peter Steenbergen 2020-01-13 10:34:47 +01:00
parent 34ab4ad2b3
commit 73ffd6fd6e
6 changed files with 137 additions and 3 deletions

View File

@ -10,6 +10,7 @@ menu "Additional drivers, libraries and/or applications"
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/btspeaker/Config.in"
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/fann/Config.in"
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/respeaker/Config.in"
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/snapcast/Config.in"
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/spotifyd/Config.in"
endmenu
menu "Additional external python modules"

View File

@ -61,7 +61,6 @@ BR2_PACKAGE_FFMPEG_FFPLAY=y
BR2_PACKAGE_FFMPEG_FFPROBE=y
BR2_PACKAGE_FFMPEG_AVRESAMPLE=y
BR2_PACKAGE_FFMPEG_POSTPROC=y
BR2_PACKAGE_FLAC=y
BR2_PACKAGE_MIMIC=y
BR2_PACKAGE_MIMIC_AUDIO_BACKEND_ALSA=y
BR2_PACKAGE_MPG123=y
@ -250,8 +249,6 @@ BR2_PACKAGE_PCRE_16=y
BR2_PACKAGE_PCRE_32=y
BR2_PACKAGE_PCRE2_16=y
BR2_PACKAGE_PCRE2_32=y
BR2_PACKAGE_AVAHI=y
BR2_PACKAGE_AVAHI_DAEMON=y
BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y
BR2_PACKAGE_BLUEZ_TOOLS=y
BR2_PACKAGE_BLUEZ5_UTILS=y
@ -322,6 +319,8 @@ BR2_PACKAGE_ALSA_PLUGINS=y
BR2_PACKAGE_BTSPEAKER=y
BR2_PACKAGE_FANN=y
BR2_PACKAGE_RESPEAKER=y
BR2_PACKAGE_SNAPCAST=y
BR2_PACKAGE_SNAPCAST_SERVER=y
BR2_PACKAGE_SPOTIFYD=y
BR2_PACKAGE_PYTHON_ADAPT_PARSER=y
BR2_PACKAGE_PYTHON_COLORZERO=y

View File

@ -0,0 +1,37 @@
config BR2_PACKAGE_SNAPCAST
bool "snapcast"
depends on BR2_USE_MMU # avahi
depends on !BR2_STATIC_LIBS # avahi
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_INSTALL_LIBSTDCPP
select BR2_PACKAGE_AVAHI
select BR2_PACKAGE_AVAHI_DAEMON
select BR2_PACKAGE_BOOST
select BR2_PACKAGE_DBUS
select BR2_PACKAGE_FLAC
select BR2_PACKAGE_LIBVORBIS
select BR2_PACKAGE_OPUS
help
Synchronous multi-room audio player
https://github.com/badaix/snapcast
if BR2_PACKAGE_SNAPCAST
config BR2_PACKAGE_SNAPCAST_CLIENT
bool "Snapclient"
default y
help
Snapcast client
config BR2_PACKAGE_SNAPCAST_SERVER
bool "Snapserver"
help
Snapcast server
endif
comment "Snapcast needs a toolchain w/ C++, threads, dynamic library"
depends on BR2_USE_MMU
depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS \
|| BR2_STATIC_LIBS

View File

@ -0,0 +1,69 @@
################################################################################
#
# snapcast
#
################################################################################
SNAPCAST_VERSION = v0.17.1
SNAPCAST_SITE = $(call github,badaix,snapcast,$(SNAPCAST_VERSION))
SNAPCAST_DEPENDENCIES = libogg alsa-lib avahi # libstdcpp libatomic libflac libvorbisidec
SNAPCAST_LICENSE = GPL-3.0+
SNAPCAST_LICENSE_FILES = LICENSE
define SNAPCLIENT_INSTALL_CONFIG
mkdir -p $(TARGET_DIR)/etc/snapcast
$(INSTALL) -m 0755 -D $(@D)/debian/snapclient.default $(TARGET_DIR)/etc/snapcast/snapclient
endef
define SNAPSERVER_INSTALL_CONFIG
mkdir -p $(TARGET_DIR)/etc/snapcast
$(INSTALL) -m 0755 -D $(@D)/debian/snapserver.default $(TARGET_DIR)/etc/snapcast/snapserver
$(INSTALL) -m 0755 -D $(@D)/server/etc/snapserver.conf $(TARGET_DIR)/etc/
endef
ifeq ($(BR2_PACKAGE_SNAPCAST_CLIENT),y)
SNAPCAST_POST_INSTALL_TARGET_HOOKS += SNAPCLIENT_INSTALL_CONFIG
define SNAPCLIENT_INSTALL_INIT_SYSV
$(INSTALL) -m 0755 -D $(SNAPCAST_PKGDIR)/S99snapclient $(TARGET_DIR)/etc/init.d/S99snapclient
endef
define SNAPCLIENT_INSTALL_INIT_SYSTEMD
$(INSTALL) -D -m 0644 $(BR2_EXTERNAL_MYCROFTOS_PATH)/package/snapcast/snapclient.service \
$(TARGET_DIR)/usr/lib/systemd/system/snapclient.service
endef
else # !BR2_PACKAGE_SNAPCAST_CLIENT
SNAPCAST_CONF_OPTS += -DBUILD_CLIENT=OFF
endif
ifeq ($(BR2_PACKAGE_SNAPCAST_SERVER),y)
SNAPCAST_POST_INSTALL_TARGET_HOOKS += SNAPSERVER_INSTALL_CONFIG
define SNAPSERVER_INSTALL_INIT_SYSV
$(INSTALL) -m 0755 -D $(SNAPCAST_PKGDIR)/S99snapserver $(TARGET_DIR)/etc/init.d/S99snapserver
endef
define SNAPSERVER_INSTALL_INIT_SYSTEMD
$(INSTALL) -D -m 0644 $(BR2_EXTERNAL_MYCROFTOS_PATH)/package/snapcast/snapserver.service \
$(TARGET_DIR)/usr/lib/systemd/system/snapserver.service
endef
else # !BR2_PACKAGE_SNAPCAST_SERVER
SNAPCAST_CONF_OPTS += -DBUILD_SERVER=OFF
endif
define SNAPCAST_INSTALL_INIT_SYSTEMD
$(SNAPCLIENT_INSTALL_INIT_SYSTEMD)
$(SNAPSERVER_INSTALL_INIT_SYSTEMD)
endef
define SNAPCAST_INSTALL_INIT_SYSV
$(SNAPCLIENT_INSTALL_INIT_SYSV)
$(SNAPSERVER_INSTALL_INIT_SYSV)
endef
$(eval $(cmake-package))

View File

@ -0,0 +1,15 @@
[Unit]
Description=Snapcast client
Documentation=man:snapclient(1)
Wants=avahi-daemon.service
After=network.target time-sync.target sound.target avahi-daemon.service
[Service]
EnvironmentFile=-/etc/snapcast/snapclient
ExecStart=/usr/bin/snapclient $SNAPCLIENT_OPTS
# very noisy on stdout
StandardOutput=null
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,13 @@
[Unit]
Description=Snapcast server
Documentation=man:snapserver(1)
Wants=avahi-daemon.service
After=network.target time-sync.target avahi-daemon.service
[Service]
EnvironmentFile=-/etc/snapcast/snapserver
ExecStart=/usr/bin/snapserver $SNAPSERVER_OPTS
Restart=on-failure
[Install]
WantedBy=multi-user.target