shairport-sync: support mqtt based remote control
authorDavid Andreoletti <david@andreoletti.net>
Sat, 9 Mar 2024 15:08:04 +0000 (23:08 +0800)
committerRosen Penev <rosenp@gmail.com>
Wed, 24 Apr 2024 19:23:38 +0000 (12:23 -0700)
Enable MQTT support to control shairport-sync remotely

Signed-off-by: David Andreoletti <david@andreoletti.net>
sound/shairport-sync/Makefile
sound/shairport-sync/files/shairport-sync.config
sound/shairport-sync/files/shairport-sync.init

index c176f01039c7110fed8d895ef15a951f4cf31576..4106f5ad2fb92122cb97781d6e9e1b479fcf02a9 100644 (file)
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=shairport-sync
 PKG_VERSION:=4.3.2
-PKG_RELEASE:=4
+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)
index bb5423501a6513d393c011c54316eb86db89d4f6..42a4acf1d7d4938afcff25a06490b07dfffcf551 100644 (file)
@@ -60,6 +60,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
index f4e7f4464a6f79261376b9bc00e1dd30cb0826e0..15339704055554ff77a3d33033b886598ec9bf8d 100644 (file)
@@ -120,6 +120,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"