mirror of
https://github.com/novatiq/packages.git
synced 2026-07-04 02:59:32 +01:00
95dedb70f6
.. because it's confusing and doesn't seem to add any value. The "auto configuration" looks for installed codec libraries and tells squeezelite (through command line arguments) to exclude codec support if a required library is missing. If you have installed squeezelite-full, then all required codec libraries are automatically installed as dependencies and the squeezelite binary won't even run if there are missing libraries - ie the "auto configuration" will always find all codecs and never disable any codecs. Toggling "auto configuration" makes no difference and the setting is just confusing. If you install squeezelite-mini the "auto configuration" can work, but library checks are already done by dlopen() calls in squeezelite and codecs are disabled if the necessary libraries are not found - ie the "auto configuration" duplicates the library checks of squeezelite itself. Signed-off-by: Robert Högberg <robert.hogberg@gmail.com>
115 lines
2.7 KiB
Bash
115 lines
2.7 KiB
Bash
#!/bin/sh /etc/rc.common
|
|
# Copyright (C) 2015 OpenWrt.org
|
|
|
|
START=99
|
|
STOP=1
|
|
|
|
USE_PROCD=1
|
|
PROG=/usr/bin/squeezelite
|
|
|
|
# Check if a codec is disabled in the configuration (ie "decode_<codec> 0")
|
|
checkcodec() {
|
|
config_get_bool codec options "$1" 1
|
|
|
|
if [ $codec -eq 0 ] ; then
|
|
if [ -z "$3" ] ; then
|
|
echo "-e $2"
|
|
else
|
|
echo "$3,$2"
|
|
fi
|
|
else
|
|
echo "$3"
|
|
fi
|
|
}
|
|
|
|
make_cmdline() {
|
|
cmdline=""
|
|
|
|
config_get name options name "SqueezeWrt"
|
|
cmdline="$cmdline -n $name"
|
|
|
|
config_get model_name options model_name "SqueezeLite"
|
|
cmdline="$cmdline -M $model_name"
|
|
|
|
config_get interface options interface ""
|
|
[ -n "$interface" ] && cmdline="$cmdline -I $interface"
|
|
|
|
config_get device options device ""
|
|
[ -n "$device" ] && cmdline="$cmdline -o $device"
|
|
|
|
config_get alsa_buffer options alsa_buffer 200
|
|
[ $alsa_buffer -eq 0 ] && alsa_buffer="200"
|
|
|
|
config_get alsa_period options alsa_period 4
|
|
[ $alsa_period -eq 0 ] && alsa_period="4"
|
|
|
|
config_get alsa_format options alsa_format 16
|
|
[ $alsa_format = "0" ] && alsa_format="16"
|
|
|
|
config_get alsa_mmap options alsa_mmap 0
|
|
cmdline="$cmdline -a $alsa_buffer:$alsa_period:$alsa_format:$alsa_mmap"
|
|
|
|
config_get stream_bufsiz options stream_bufsiz 2048
|
|
config_get out_bufsiz options out_bufsiz 3763
|
|
cmdline="$cmdline -b $stream_bufsiz:$out_bufsiz"
|
|
|
|
config_get max_sr options max_sr 0
|
|
if [ $max_sr -ne 0 ] ; then
|
|
max_sr="-r $max_sr"
|
|
|
|
config_get sr_delay options sr_delay 0
|
|
[ $sr_delay -ne 0 ] && max_sr="$max_sr:$sr_delay"
|
|
cmdline="$cmdline $max_sr"
|
|
fi
|
|
|
|
|
|
config_get close_delay options close_delay 0
|
|
[ $close_delay -ne 0 ] && cmdline="$cmdline -C $close_delay"
|
|
|
|
config_get server_addr options server_addr ""
|
|
if [ -n "$server_addr" ] ; then
|
|
config_get server_port options server_port 3483
|
|
cmdline="$cmdline -s $server_addr:$server_port"
|
|
fi
|
|
|
|
config_get priority options priority 0
|
|
[ $priority -ne 0 ] && cmdline="$cmdline -p $priority"
|
|
|
|
local excl_codecs=""
|
|
excl_codecs=$(checkcodec decode_flac flac "$excl_codecs")
|
|
excl_codecs=$(checkcodec decode_mp3 mp3 "$excl_codecs")
|
|
excl_codecs=$(checkcodec decode_aac aac "$excl_codecs")
|
|
excl_codecs=$(checkcodec decode_ogg ogg "$excl_codecs")
|
|
excl_codecs=$(checkcodec decode_wma_alac wma,alac "$excl_codecs")
|
|
cmdline="$cmdline $excl_codecs"
|
|
|
|
config_get dop options dsd_over_pcm 0
|
|
[ $dop -eq 1 ] && cmdline="$cmdline -D"
|
|
}
|
|
|
|
start_service() {
|
|
config_load squeezelite
|
|
|
|
config_get_bool enabled options 'enabled' 0
|
|
[ $enabled -eq 0 ] && return
|
|
|
|
# Build command params
|
|
make_cmdline
|
|
|
|
procd_open_instance
|
|
logger -t 'squeezelite' "$cmdline"
|
|
procd_set_param command "$PROG" $cmdline
|
|
procd_close_instance
|
|
}
|
|
|
|
# Wait for service to exit and release sockets
|
|
reload_service() {
|
|
stop
|
|
sleep 2
|
|
start
|
|
}
|
|
|
|
restart() {
|
|
reload_service
|
|
}
|