summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-07-18 12:06:10 -0500
committerCase Duckworth2022-07-18 12:06:10 -0500
commitf9ef805e513918115334746e11dadf7be9b921a0 (patch)
treeb7cc418fc17c83d1ca5daf2380aaa1035525006c
parentFancify radio_status (diff)
downloadradio-f9ef805e513918115334746e11dadf7be9b921a0.tar.gz
radio-f9ef805e513918115334746e11dadf7be9b921a0.zip
Add -r command line option: Resume last played station HEAD main
-rwxr-xr-xradio6
1 files changed, 5 insertions, 1 deletions
diff --git a/radio b/radio index 8209ac7..d94d585 100755 --- a/radio +++ b/radio
@@ -31,6 +31,7 @@ FLAGS:
31 -h Show this help. 31 -h Show this help.
32 -k Kill the currently-playing radio invocation. 32 -k Kill the currently-playing radio invocation.
33 -K Kill all instances of $RADIO_PLAYER. 33 -K Kill all instances of $RADIO_PLAYER.
34 -r Begin playing most recently-played radio, or prompt user.
34 -e Edit \$RADIO_STATIONS using \$EDITOR. 35 -e Edit \$RADIO_STATIONS using \$EDITOR.
35 -s Show radio's status and exit. 36 -s Show radio's status and exit.
36 -S Show radio's status until the user quits with C-c. 37 -S Show radio's status until the user quits with C-c.
@@ -44,7 +45,7 @@ EOF
44} 45}
45 46
46main() { 47main() {
47 while getopts :kKsShel: opt; do 48 while getopts :kKrsShel: opt; do
48 case $opt in 49 case $opt in
49 h) usage ;; 50 h) usage ;;
50 k) _radio_kill ;; 51 k) _radio_kill ;;
@@ -52,6 +53,7 @@ main() {
52 pkill "$RADIO_PLAYER" 53 pkill "$RADIO_PLAYER"
53 exit 54 exit
54 ;; 55 ;;
56 r) set -- "$(cat /tmp/radio.last_played)" ;;
55 e) _radio_edit ;; 57 e) _radio_edit ;;
56 s) _radio_status ;; 58 s) _radio_status ;;
57 S) _radio_status -f ;; 59 S) _radio_status -f ;;
@@ -103,6 +105,8 @@ _radio_play() {
103 station="$candidates" 105 station="$candidates"
104 fi 106 fi
105 107
108 echo "$station" | cut -f $_radio_desc >/tmp/radio.last_played
109
106 if [ -f "$RADIO_PID_FILE" ]; then 110 if [ -f "$RADIO_PID_FILE" ]; then
107 _radio_kill_impl 111 _radio_kill_impl
108 fi 112 fi