diff options
author | Case Duckworth | 2022-07-07 13:53:42 -0500 |
---|---|---|
committer | Case Duckworth | 2022-07-07 13:53:42 -0500 |
commit | b673c0bdf92d4cea24f81f8797c8e7aa37078272 (patch) | |
tree | f1c384ceb128841376de14aef097c700a7154924 | |
parent | Add make link target (diff) | |
download | radio-b673c0bdf92d4cea24f81f8797c8e7aa37078272.tar.gz radio-b673c0bdf92d4cea24f81f8797c8e7aa37078272.zip |
Add -s/-S options for status
-rwxr-xr-x | radio | 7 |
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 | ||
11 | RADIO_PID_FILE=/tmp/radio.pid | 11 | RADIO_PID_FILE=/tmp/radio.pid |
12 | RADIO_STATUS_FILE=/tmp/radio.status | ||
12 | 13 | ||
13 | usage() { | 14 | usage() { |
14 | cat <<EOF | 15 | cat <<EOF |
15 | RADIO: play the radio | 16 | RADIO: play the radio |
16 | USAGE: radio -h | 17 | USAGE: 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: | |||
28 | FLAGS: | 30 | FLAGS: |
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 | } |