From f78cd57ee48d80079a2f138c2a1660ae9229b56c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 28 Oct 2014 22:33:00 +0100 Subject: [PATCH] shairport: improve config and init script (disabled, respawn, err file, meta dir, audio output options). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Álvaro Fernández Rojas --- multimedia/shairport/Makefile | 2 +- multimedia/shairport/files/shairport.config | 24 +++++++++++-- multimedia/shairport/files/shairport.init | 39 ++++++++++++++++++--- 3 files changed, 57 insertions(+), 8 deletions(-) diff --git a/multimedia/shairport/Makefile b/multimedia/shairport/Makefile index 35678c7cc..0b7170766 100644 --- a/multimedia/shairport/Makefile +++ b/multimedia/shairport/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=shairport -PKG_VERSION:=2014-08-22 +PKG_VERSION:=2014-10-28 PKG_RELEASE:=$(PKG_SOURCE_VERSION) PKG_SOURCE_PROTO:=git diff --git a/multimedia/shairport/files/shairport.config b/multimedia/shairport/files/shairport.config index 851c927e4..9b2165a9a 100644 --- a/multimedia/shairport/files/shairport.config +++ b/multimedia/shairport/files/shairport.config @@ -1,12 +1,16 @@ config shairport main + option disabled '1' + option respawn '1' option bname 'AirPort' option password '' option port '5002' - option buffer '256' - option log '' + option buffer '' + option log_file '' + option err_file '' + option meta_dir '' option cmd_start '' option cmd_stop '' - option cmd_wait '' + option cmd_wait '0' option audio_output 'alsa' option mdns 'avahi' @@ -16,3 +20,17 @@ config shairport main option mixer_type '' option mixer_control '' option mixer_index '' + + # options for ao output + option ao_driver '' + option ao_name '' + option ao_id '' + option ao_options '' + + # options for pipe output + option output_fifo '' + + # options for pulse output + option pulse_server '' + option pulse_sink '' + option pulse_appname '' diff --git a/multimedia/shairport/files/shairport.init b/multimedia/shairport/files/shairport.init index 0e649d684..341ff6fee 100644 --- a/multimedia/shairport/files/shairport.init +++ b/multimedia/shairport/files/shairport.init @@ -28,16 +28,21 @@ append_bool() { start_instance() { local cfg="$1" - local ao dev + local ao dev aux + + config_get_bool aux "$cfg" 'disabled' '0' + [ "$aux" = 1 ] && return 1 procd_open_instance procd_set_param command /usr/bin/shairport append_arg "$cfg" bname "-a" "AirPort" - append_arg "$cfg" log "-l" - append_arg "$cfg" buffer "-b" "256" - append_arg "$cfg" port "-p" "5002" + append_arg "$cfg" log_file "-l" + append_arg "$cfg" err_file "-e" + append_arg "$cfg" meta_dir "-M" + append_arg "$cfg" buffer "-b" + append_arg "$cfg" port "-p" append_arg "$cfg" password "-k" append_arg "$cfg" mdns "-m" @@ -58,8 +63,34 @@ start_instance() { append_arg "$cfg" mixer_control "-c" append_arg "$cfg" mixer_index "-i" fi + elif [ "$ao" = "ao" ]; then + config_get dev "$cfg" ao_driver "" + if [ -n "$dev" ]; then + procd_append_param command "--" + append_arg "$cfg" ao_driver "-d" + append_arg "$cfg" ao_id "-i" + append_arg "$cfg" ao_name "-n" + append_arg "$cfg" ao_options "-o" + fi + elif [ "$ao" = "pipe" ]; then + config_get dev "$cfg" output_fifo "" + if [ -n "$dev" ]; then + procd_append_param command "--" + append_arg "$cfg" output_fifo "" + fi + elif [ "$ao" = "pulse" ]; then + config_get dev "$cfg" pulse_server "" + if [ -n "$dev" ]; then + procd_append_param command "--" + append_arg "$cfg" pulse_server "-a" + append_arg "$cfg" pulse_sink "-s" + append_arg "$cfg" pulse_appname "-n" + fi fi + config_get_bool aux "$cfg" 'respawn' '0' + [ "$aux" = 1 ] && procd_set_param respawn + procd_close_instance }