Skip to content

Commit

Permalink
Add runtime configuration environment support for shairport
Browse files Browse the repository at this point in the history
  • Loading branch information
fabienheureux committed Oct 27, 2024
1 parent 108926d commit a01a62e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions plugins/airplay/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,26 @@ if [[ -n "$SOUND_DISABLE_AIRPLAY" ]]; then
exit 0
fi


# --- ENV VARS ---
# SOUND_DEVICE_NAME: Set the device broadcast name for AirPlay
SOUND_DEVICE_NAME=${SOUND_DEVICE_NAME:-"balenaSound AirPlay $(echo "$BALENA_DEVICE_UUID" | cut -c -4)"}

echo "Starting AirPlay plugin..."
echo "Device name: $SOUND_DEVICE_NAME"

# Check if LATENCY_OFFSET is set
if [[ -n "$SOUND_AIRPLAY_LATENCY_OFFSET" ]]; then
# File to modify
file="/etc/shairport-sync.conf"

# Use sed to replace the value in the specified line
sed -i "s|//[[:space:]]*audio_backend_latency_offset_in_seconds[[:space:]]*=.*;| audio_backend_latency_offset_in_seconds = $SOUND_AIRPLAY_LATENCY_OFFSET;|" "$file"

echo "Updated audio_backend_latency_offset_in_seconds to $LATENCY_OFFSET in $file"
fi


# Start AirPlay
echo "Starting Shairport Sync"
exec shairport-sync \
Expand Down

0 comments on commit a01a62e

Please sign in to comment.