noagendastream.sh: fix syntax error and player detection
Replace the invalid 'else [ ... ];then' with elif, detect players with command -v, and print an error when no player is installed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+10
-6
@@ -1,10 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
STREAM="http://listen.noagendastream.com/noagenda"
|
||||||
|
|
||||||
if [ -f /usr/bin/mpv ];then
|
if command -v mpv >/dev/null 2>&1; then
|
||||||
mpv "http://listen.noagendastream.com/noagenda"
|
mpv "$STREAM"
|
||||||
elif [ -f "/usr/bin/vlc" ];then
|
elif command -v vlc >/dev/null 2>&1; then
|
||||||
vlc "http://listen.noagendastream.com/noagenda"
|
vlc "$STREAM"
|
||||||
else [ -f "/usr/bin/xdg-open" ];then
|
elif command -v xdg-open >/dev/null 2>&1; then
|
||||||
xdg-open "http://listen.noagendastream.com/noagenda"
|
xdg-open "$STREAM"
|
||||||
|
else
|
||||||
|
echo "No player found. Install mpv or vlc." >&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user