mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
shairport-sync: New package from MikeBrady
Signed-off-by: Ted Hess <thess@kitschensync.net>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
# Uncomment the stanza you want, and make sure to comment out the others, especially duplicate options.
|
||||
|
||||
#Arguments and defaults are as follows
|
||||
config shairport-sync main
|
||||
# option name 'Shairport Sync' #default name, "Shairport Sync on %d"
|
||||
# option device default #default soundcard, volume control by software
|
||||
#(Troubleshooting hint: make sure the soundcard's volume is turned up fully -- use alsamixer or amixer)
|
||||
# option airplaylatency 88200
|
||||
# option ituneslatency 99400
|
||||
# option port 5000
|
||||
# option stuffing basic #options are 'basic' or 'soxr' if shairport-sync was compiled with soxr support
|
||||
# option awaitactioncompletion false #[don't] wait until beforeaction or afteraction completes
|
||||
# option beforeaction <action> #action must be a fully qualified program with no arguments. Default no action.
|
||||
# option afteraction <action> #action must be a fully qualified program with no arguments. Default no action.
|
||||
# option devicetype <devicetype>
|
||||
# option volumecontrolname <name>
|
||||
|
||||
#Here are some sample stanzas:
|
||||
|
||||
#For Raspberry Pi using the built-in soundcard for the headphone jack
|
||||
# option device 'hw:0'
|
||||
# option devicetype hardware
|
||||
# option volumecontrolname Master
|
||||
|
||||
#For Raspberry Pi with the "3D Sound" USB Soundcard
|
||||
# option name 'Pi'
|
||||
# option device 'hw:1'
|
||||
# option devicetype hardware
|
||||
# option volumecontrolname Speaker
|
||||
|
||||
#For Raspberry Pi with the first generation iMic or the Topping TP30 Class T Digital Mini Amplifier
|
||||
# option name 'Kitchen'
|
||||
# option device 'hw:1'
|
||||
# option devicetype hardware
|
||||
# option volumecontrolname PCM
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
NAME='shairport-sync'
|
||||
START=99
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
append_arg() {
|
||||
local cfg="$1"
|
||||
local var="$2"
|
||||
local opt="$3"
|
||||
local def="$4"
|
||||
local val
|
||||
|
||||
config_get val "$cfg" "$var"
|
||||
[ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}"
|
||||
}
|
||||
|
||||
append_bool() {
|
||||
local cfg="$1"
|
||||
local var="$2"
|
||||
local opt="$3"
|
||||
local def="$4"
|
||||
local val
|
||||
|
||||
config_get_bool val "$cfg" "$var" "$def"
|
||||
[ "$val" = 1 ] && procd_append_param command "$opt"
|
||||
}
|
||||
|
||||
start_shairport_service() {
|
||||
local cfg=$1
|
||||
local stuffing
|
||||
local device
|
||||
|
||||
procd_open_instance
|
||||
|
||||
procd_set_param command /usr/bin/$NAME
|
||||
|
||||
append_arg "$cfg" name "-a"
|
||||
append_arg "$cfg" port "-p"
|
||||
append_arg "$cfg" airplaylatency "-A"
|
||||
append_arg "$cfg" ituneslatency "-i"
|
||||
|
||||
config_get stuffing "$cfg" stuffing ""
|
||||
|
||||
if [ -n "$stuffing" ] ; then
|
||||
case "x$stuffing" in
|
||||
( "xbasic" ) procd_append_param command -S basic ;;
|
||||
( "xsoxr" ) procd_append_param command -S soxr ;;
|
||||
( * ) logger "bad argument for -S option -- should be \"basic\" or \"soxr\"" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
append_arg "$cfg" beforeaction "-B"
|
||||
append_arg "$cfg" afteraction "-E"
|
||||
append_bool "$cfg" awaitactioncompletion "-w"
|
||||
|
||||
config_get device "$cfg" device ""
|
||||
if [ -n "$device" ] ; then
|
||||
procd_append_param command "--"
|
||||
append_arg "$cfg" device "-d"
|
||||
append_arg "$cfg" devicetype "-t"
|
||||
append_arg "$cfg" volumecontrolname "-c"
|
||||
fi
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger $NAME
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load $NAME
|
||||
# Just a single instance
|
||||
start_shairport_service "main"
|
||||
}
|
||||
Reference in New Issue
Block a user