summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-07-07 13:53:42 -0500
committerCase Duckworth2022-07-07 13:53:42 -0500
commitb673c0bdf92d4cea24f81f8797c8e7aa37078272 (patch)
treef1c384ceb128841376de14aef097c700a7154924
parentAdd make link target (diff)
downloadradio-b673c0bdf92d4cea24f81f8797c8e7aa37078272.tar.gz
radio-b673c0bdf92d4cea24f81f8797c8e7aa37078272.zip
Add -s/-S options for status
-rwxr-xr-xradio7
1 files changed, 6 insertions, 1 deletions
diff --git a/radio b/radio index d0c12a6..2078dfe 100755 --- a/radio +++ b/radio
@@ -9,12 +9,14 @@ _radio_desc=2
9_radio_tags=3 9_radio_tags=3
10 10
11RADIO_PID_FILE=/tmp/radio.pid 11RADIO_PID_FILE=/tmp/radio.pid
12RADIO_STATUS_FILE=/tmp/radio.status
12 13
13usage() { 14usage() {
14 cat <<EOF 15 cat <<EOF
15RADIO: play the radio 16RADIO: play the radio
16USAGE: radio -h 17USAGE: radio -h
17 radio -k 18 radio -k
19 radio [-s|-S]
18 radio -l [QUERY] 20 radio -l [QUERY]
19 radio [STATION] 21 radio [STATION]
20 22
@@ -28,7 +30,10 @@ PARAMETERS:
28FLAGS: 30FLAGS:
29 -h Show this help. 31 -h Show this help.
30 -k Kill the currently-playing radio invocation. 32 -k Kill the currently-playing radio invocation.
33 -K Kill all instances of $RADIO_PLAYER.
31 -e Edit \$RADIO_STATIONS using \$EDITOR. 34 -e Edit \$RADIO_STATIONS using \$EDITOR.
35 -s Show radio's status and exit.
36 -S Show radio's status until the user quits with C-c.
32 -l [QUERY] List all known stations and exit. 37 -l [QUERY] List all known stations and exit.
33 If QUERY is present, filter the list to those stations 38 If QUERY is present, filter the list to those stations
34 matching QUERY. 39 matching QUERY.
@@ -54,7 +59,7 @@ _radio_play() {
54 station="$candidates" 59 station="$candidates"
55 fi 60 fi
56 echo >&2 "Playing $(echo "$station" | cut -f $_radio_desc)..." 61 echo >&2 "Playing $(echo "$station" | cut -f $_radio_desc)..."
57 "$RADIO_PLAYER" "$(echo "$station" | cut -f $_radio_url)" & 62 "$RADIO_PLAYER" "$(echo "$station" | cut -f $_radio_url)" >"$RADIO_STATUS_FILE" 2>&1 &
58 echo $! >"$RADIO_PID_FILE" 63 echo $! >"$RADIO_PID_FILE"
59 exit 64 exit
60} 65}