From 68ca9453a4ef8530c10e40eae25ee7af89012429 Mon Sep 17 00:00:00 2001 From: David Andreoletti Date: Sat, 9 Mar 2024 23:08:04 +0800 Subject: [PATCH] shairport-sync: support mqtt based remote control Enable MQTT support to control shairport-sync remotely Signed-off-by: David Andreoletti --- sound/shairport-sync/Makefile | 5 +++-- sound/shairport-sync/files/shairport-sync.config | 11 +++++++++++ sound/shairport-sync/files/shairport-sync.init | 15 +++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/sound/shairport-sync/Makefile b/sound/shairport-sync/Makefile index 4850713927..4106f5ad2f 100644 --- a/sound/shairport-sync/Makefile +++ b/sound/shairport-sync/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=shairport-sync PKG_VERSION:=4.3.2 -PKG_RELEASE:=3 +PKG_RELEASE:=5 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/mikebrady/shairport-sync/tar.gz/$(PKG_VERSION)? @@ -29,7 +29,7 @@ define Package/shairport-sync/default SECTION:=sound CATEGORY:=Sound TITLE:=AirPlay compatible audio player - DEPENDS:=@AUDIO_SUPPORT +libpthread +alsa-lib +libconfig +libdaemon +libpopt +libplist +libsodium +libgcrypt +libffmpeg-full +libuuid +nqptp + DEPENDS:=@AUDIO_SUPPORT +libpthread +alsa-lib +libconfig +libdaemon +libpopt +libplist +libsodium +libgcrypt +libffmpeg-full +libuuid +nqptp +libmosquitto PROVIDES:=shairport-sync URL:=https://github.com/mikebrady/shairport-sync endef @@ -80,6 +80,7 @@ CONFIGURE_ARGS += \ --with-libdaemon \ --with-airplay-2 \ --with-pipe \ + --with-mqtt-client \ --with-metadata ifeq ($(BUILD_VARIANT),openssl) diff --git a/sound/shairport-sync/files/shairport-sync.config b/sound/shairport-sync/files/shairport-sync.config index fa1a8dddc4..5475335e53 100644 --- a/sound/shairport-sync/files/shairport-sync.config +++ b/sound/shairport-sync/files/shairport-sync.config @@ -56,6 +56,17 @@ config shairport-sync 'shairport_sync' # Stdout option stdout_latency_offset '' # 0 option stdout_buffer_length '' # 44100 + # MQTT: https://github.com/mikebrady/shairport-sync/blob/master/MQTT.md + option mqtt_enabled 'no' + option mqtt_hostname '127.0.0.1' + option mqtt_port '1883' + option mqtt_username '' # empty = no authentication + option mqtt_password '' # empty = no authentication + option mqtt_topic 'shairport' + option mqtt_publish_raw 'no' + option mqtt_publish_parsed 'no' + option mqtt_publish_cover 'no' + option mqtt_enable_remote 'no' # AO option ao_latency_offset '' # 0 option ao_buffer_length '' # 44100 diff --git a/sound/shairport-sync/files/shairport-sync.init b/sound/shairport-sync/files/shairport-sync.init index 1f0877535e..c9af6f1217 100644 --- a/sound/shairport-sync/files/shairport-sync.init +++ b/sound/shairport-sync/files/shairport-sync.init @@ -116,6 +116,21 @@ start_instance() { append_num "$cfg" stdout_buffer_length "audio_backend_buffer_desired_length" printf "};\n\n" + # MQTT + printf "mqtt =\n" + printf "{\n" + append_str "$cfg" mqtt_enabled "enabled" + append_str "$cfg" mqtt_hostname "hostname" + append_num "$cfg" mqtt_port "port" + append_str "$cfg" mqtt_username "username" + append_str "$cfg" mqtt_password "password" + append_str "$cfg" mqtt_topic "topic" + append_str "$cfg" mqtt_publish_raw "publish_raw" + append_str "$cfg" mqtt_publish_parsed "publish_parsed" + append_str "$cfg" mqtt_publish_cover "publish_cover" + append_str "$cfg" mqtt_enable_remote "enable_remote" + printf "};\n\n" + # AO audio back end printf "ao =\n" printf "{\n"