(untabify + minor text edits)

This commit is contained in:
mgr 2020-03-27 11:35:59 +01:00
parent 30f73dac39
commit 5e3bc9d881
3 changed files with 19 additions and 19 deletions

View file

@ -16,9 +16,9 @@ You can automatically load the module by adding this to your
(load-module "stump-radio")
It is suggested to make two commands globally available by some unused
keys on your keyboard by adding this to your ~/.stumpwm.d/init.lisp as
well:
It is suggested to make two or three commands globally available
by some unused keys on your keyboard by adding this to your
~/.stumpwm.d/init.lisp as well:
(define-key *top-map* (kbd "XF86Tools") "radio-previous-station")
(define-key *top-map* (kbd "XF86Launch5") "radio-toggle-playback")

View file

@ -4,6 +4,6 @@
(:use #:cl #:stumpwm)
(:export ;; commands:
#:radio-start #:radio-stop #:radio-toggle-playback #:radio-force-restart
#:radio-next-station #:radio-previous-station #:radio-list-stations
;; functions:
#:add-station #:remove-station #:list-stations))
#:radio-next-station #:radio-previous-station #:radio-list-stations
;; functions:
#:add-station #:remove-station #:list-stations))

View file

@ -19,7 +19,7 @@
(defun next-radio-station ()
(setf (cdr (last *stations*)) (list (car *stations*))
*stations* (cdr *stations*))
*stations* (cdr *stations*))
(car *stations*))
(defun previous-radio-station ()
@ -41,29 +41,29 @@
(defun radio-status-change (process)
(message (format nil "radio status changed to: ~a (PID: ~a)"
(sb-ext:process-status process)
(sb-ext:process-pid process))))
(sb-ext:process-status process)
(sb-ext:process-pid process))))
(defcommand radio-start () ()
"start radio if not running"
(if (radio-running-p)
(message "Warning: radio already running, not starting.")
(destructuring-bind (name . url)
(car *stations*)
(message (format nil "Starting ~a radio..." name))
(setf *radio*
(sb-ext:run-program "/usr/bin/mplayer" (list url)
:wait nil
:status-hook #'radio-status-change)))))
(car *stations*)
(message (format nil "Starting ~a radio..." name))
(setf *radio*
(sb-ext:run-program "/usr/bin/mplayer" (list url)
:wait nil
:status-hook #'radio-status-change)))))
(defcommand radio-stop () ()
"stop radio if running"
(if (not (radio-running-p))
(message "Warning: radio not running, not stopping.")
(progn
(message "Stopping radio...")
(sb-ext:process-close *radio*) ;; close (to supress status changed hook)
(sb-ext:process-kill *radio* 15) ;; SIGTERM
(setf *radio* nil))))
(message "Stopping radio...")
(sb-ext:process-close *radio*) ;; close (to supress status changed hook)
(sb-ext:process-kill *radio* 15) ;; SIGTERM
(setf *radio* nil))))
(defcommand radio-toggle-playback () ()
"stop radio if running and start playing if not"