12-06-2019, 03:01 AM
(This post was last modified: 12-22-2019, 09:55 PM by TheOldPresbyope.
Edit Reason: obscure the credentials
)
Update:
2 days later, no drop-outs. That's me converted.
NOTE: This does NOT fix librespot crashing when there is a network interruption; however THAT crash has log entries and can be watched/restarted (I'll build that into the script later).
Here's the script I'm using to start/restart/stop librespot:
2 days later, no drop-outs. That's me converted.
NOTE: This does NOT fix librespot crashing when there is a network interruption; however THAT crash has log entries and can be watched/restarted (I'll build that into the script later).
Here's the script I'm using to start/restart/stop librespot:
Code:
#!/bin/bash
launch_librespot () {
screen -dmS librespot `which librespot` \
--name osmc \
--bitrate 320 \
--initial-volume 50 \
--enable-volume-normalisation \
--disable-audio-cache \
--verbose \
--username XXXXXXXXXXX \
--password XXXXXXXXXXX \
--backend alsa
#--device plughw:0 \
#--onevent /var/local/www/commandw/spotevent.sh
echo "librespot started"
}
if [[ "$1" == "start" ]]; then
if [[ -z `screen -ls | grep librespot` ]]; then
launch_librespot
else
echo "librespot is already running"
fi
exit 1
elif [[ "$1" == "restart" ]]; then
if [[ -z `screen -ls | grep librespot` ]]; then
echo "librespot not running"
else
echo "restarting librespot"
kill -9 `screen -ls librespot | grep librespot | cut -d "." -f 1`
screen -wipe | 1>/dev/null
fi
launch_librespot
exit 1
elif [[ "$1" == "stop" ]]; then
if [[ -z `screen -ls | grep librespot` ]]; then
echo "librespot not running"
else
echo "stopping librespot"
kill -9 `screen -ls librespot | grep librespot | cut -d "." -f 1`
screen -wipe | 1>/dev/null
fi
exit 1
else
echo "function: ./librespot [start|restart|stop]"
fi