mpv reloads properly if it crashes

This commit is contained in:
DeaDvey 2024-11-05 01:20:33 +00:00
parent 3e947c2199
commit d52f821408

View File

@ -27,14 +27,11 @@ handle_sigint() {
trap handle_sigint SIGINT
while [ $quit_mpv = false ]; do
#echo $quit_mpv
mpv_running=$(pidof mpv)
if [ -z "$mpv_running" ] && [ $quit_mpv = false ]; then
if [ -z "$(pidof mpv)" ] && [ $quit_mpv = false ]; then
echo "mpv process not found, (re)starting..."
mpv --shuffle --really-quiet $playlist_path --input-ipc-server=/tmp/mpvsocket &
fi
sleep 0.5
while [ $quit_mpv = false ]; do
fi
path=$(echo '{ "command": ["get_property", "path"] }' | socat - "/tmp/mpvsocket" | jq -r '.data')
if [[ $path != $previous_songs_path ]]; then
clear
@ -55,6 +52,5 @@ while [ $quit_mpv = false ]; do
fi
previous_songs_path=$path
sleep 0.5
done
done