From 2cfe46089131ed03f901b628f96262de8822c3c5 Mon Sep 17 00:00:00 2001 From: duhow Date: Sun, 22 Dec 2024 23:45:11 +0100 Subject: [PATCH] packages(shairport-sync): improve default configuration use ALSA mixer control for volume, use volume color show, prepare pipe --- .../shairport-sync/config/shairport-sync.conf | 21 +++++++++++++++++++ packages/shairport-sync/config/shairport.init | 19 ++++++++++++++--- packages/shairport-sync/package.mk | 1 + 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 packages/shairport-sync/config/shairport-sync.conf diff --git a/packages/shairport-sync/config/shairport-sync.conf b/packages/shairport-sync/config/shairport-sync.conf new file mode 100644 index 0000000..b14ce9f --- /dev/null +++ b/packages/shairport-sync/config/shairport-sync.conf @@ -0,0 +1,21 @@ +general = +{ + airplay_device_id = 0x%MAC%L; + run_this_when_volume_is_set = "/bin/volume color -q"; + dbus_service_bus = "system"; +}; + +alsa = +{ + mixer_control_name = "mysoftvol"; +}; + +pipe = +{ + name = "/tmp/shairport-sync-audio"; +}; + +diagnostics = +{ + log_verbosity = 0; +}; diff --git a/packages/shairport-sync/config/shairport.init b/packages/shairport-sync/config/shairport.init index f90de22..64ab5e6 100755 --- a/packages/shairport-sync/config/shairport.init +++ b/packages/shairport-sync/config/shairport.init @@ -4,24 +4,37 @@ START=98 USE_PROCD=1 +EXTRA_COMMANDS="start_pipe" PROG=shairport-sync CONF=/data/${PROG}.conf NQPTP=/usr/bin/nqptp +ADDITIONAL_ARGS="" start_service() { if [ ! -f "${CONF}" ]; then + # copy file and remove comments grep -ve '^//' /etc/${PROG}.conf > ${CONF} + + # set static identifier from MAC + # cat /sys/class/net/wlan0/address + MAC_ADDRESS=$(micocfg_mac | tr -d ':' | tr 'a-f' 'A-F') + sed -i "s/%MAC%/${MAC_ADDRESS}/g" ${CONF} fi if [ -e "$NQPTP" ]; then - procd_open_instance + procd_open_instance nqptp procd_set_param command $NQPTP procd_set_param respawn 3600 5 5 procd_close_instance fi - procd_open_instance - procd_set_param command /usr/bin/${PROG} -c ${CONF} + procd_open_instance shairport + procd_set_param command /usr/bin/${PROG} -c "${CONF}" ${ADDITIONAL_ARGS} procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5} procd_close_instance } + +start_pipe() { + ADDITIONAL_ARGS="-o pipe" + start +} diff --git a/packages/shairport-sync/package.mk b/packages/shairport-sync/package.mk index 727ef3a..057ac3c 100644 --- a/packages/shairport-sync/package.mk +++ b/packages/shairport-sync/package.mk @@ -72,6 +72,7 @@ install_package() { postinstall_package() { mkdir -p ${STAGING_DIR}/etc/init.d ${STAGING_DIR}/etc/rc.d + cp -vf ${PACKAGE_DIR}/config/shairport-sync.conf ${STAGING_DIR}/etc/shairport-sync.conf cp -vf ${PACKAGE_DIR}/config/shairport.init ${STAGING_DIR}/etc/init.d/shairport-sync chmod 755 ${STAGING_DIR}/etc/init.d/shairport-sync ln -svf ../init.d/shairport-sync ${STAGING_DIR}/etc/rc.d/S98shairport-sync