From aa56438010d3a4adf45ec1403da2a52489416461 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Thu, 29 Feb 2024 23:41:14 -0500 Subject: [PATCH] shairport-sync: stop MPD before playing --- recipes-multimedia/shairport-sync/files/mpc-stop.sh | 7 +++++++ recipes-multimedia/shairport-sync/shairport-sync_git.bb | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 recipes-multimedia/shairport-sync/files/mpc-stop.sh diff --git a/recipes-multimedia/shairport-sync/files/mpc-stop.sh b/recipes-multimedia/shairport-sync/files/mpc-stop.sh new file mode 100644 index 0000000..03fa34c --- /dev/null +++ b/recipes-multimedia/shairport-sync/files/mpc-stop.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# This script is used by shairport-sync to stop MPD +# before starting a new playback session, so that it can +# access the sound card. + +mpc stop diff --git a/recipes-multimedia/shairport-sync/shairport-sync_git.bb b/recipes-multimedia/shairport-sync/shairport-sync_git.bb index 9b3d826..9c104dd 100644 --- a/recipes-multimedia/shairport-sync/shairport-sync_git.bb +++ b/recipes-multimedia/shairport-sync/shairport-sync_git.bb @@ -9,6 +9,7 @@ SRC_URI = "git://github.com/mikebrady/shairport-sync;protocol=https;branch=${SRC SRC_URI += " \ file://0001-yocto-disable-user-group-creation.patch \ file://shairport-sync.conf.in \ + file://mpc-stop.sh \ " S = "${WORKDIR}/git" @@ -34,6 +35,13 @@ do_install:append() { ${WORKDIR}/shairport-sync.conf.in > ${WORKDIR}/shairport-sync.conf install -d ${D}${sysconfdir}/ install -m 0644 ${WORKDIR}/shairport-sync.conf ${D}${sysconfdir}/ + + # Modify shairport-sync start arguments to always stop MPD before playing: + sed -i -e "s@^\(ExecStart=.*\)@\1 -w --on-start=${bindir}/mpc-stop.sh@g" \ + ${D}${systemd_unitdir}/system/shairport-sync.service + + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/mpc-stop.sh ${D}${bindir} } SYSTEMD_SERVICE:${PN} = " \ -- 2.20.1