diff --git a/radio b/radio new file mode 100755 index 0000000..60fe8ad --- /dev/null +++ b/radio @@ -0,0 +1,27 @@ +#!/bin/sh + +#Сценарий прослушивания радиостанций +#Формат списка: name;playlist + +STATIONS=$SHELLRC/etc/soft/radio/stations + +plays() { + echo $1 + PLAYLIST=$(cat $STATIONS | grep "$1" | cut -d ';' -f 2) + + echo $PLAYLIST | grep 'http' + + if [ $? -eq 0 ]; then + killall play 2>/dev/null + STREAM=$(curl -s $PLAYLIST | grep 'http://' | sed 's/^.*http/http/' | head -n 1) + curl -s $STREAM | play -q -t mp3 - + fi +} + +CH=$(cat $STATIONS | cut -d ';' -f 1 | dmenu -fn '-*-fixed-*-*-*-*-15-*-*-*-*-*-*-*' -l 10) + +case $CH in + STOP) killall play 2>/dev/null;; + *) plays "$CH";; +esac +