Check if player pid exists

This commit is contained in:
Shahin Agha-Ghassem 2023-03-29 21:57:20 +02:00
parent a5a6781fbb
commit 4288e0ebe5

8
iptv
View File

@ -91,10 +91,12 @@ selected_channel_name=$(echo "$selected_channel_line" | sed 's/\(.*\) url:.*/\1/
printf "Playing %s from %s" "$selected_channel_url" "$selected_channel_name" printf "Playing %s from %s" "$selected_channel_url" "$selected_channel_name"
player_pid=$(cat "$player_pid_file") if [ -f "$player_pid_file" ]; then
player_pid=$(cat "$player_pid_file")
if kill -0 "$player_pid" >/dev/null 2>&1; then if kill -0 "$player_pid" >/dev/null 2>&1; then
kill "$player_pid" kill "$player_pid"
fi
fi fi
mpv "$selected_channel_url" > /dev/null 2>&1 & mpv "$selected_channel_url" > /dev/null 2>&1 &