diff options
Diffstat (limited to 'lisp/+bongo.el')
-rw-r--r-- | lisp/+bongo.el | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/lisp/+bongo.el b/lisp/+bongo.el index d1a2ef4..da68024 100644 --- a/lisp/+bongo.el +++ b/lisp/+bongo.el | |||
@@ -4,6 +4,10 @@ | |||
4 | 4 | ||
5 | ;;; Code: | 5 | ;;; Code: |
6 | 6 | ||
7 | (defgroup +bongo nil | ||
8 | "Extra customization for `bongo'." | ||
9 | :group 'bongo) | ||
10 | |||
7 | (defun +bongo-notify () | 11 | (defun +bongo-notify () |
8 | (notifications-notify | 12 | (notifications-notify |
9 | :title "Now Playing" | 13 | :title "Now Playing" |
@@ -13,5 +17,44 @@ | |||
13 | :urgency 'low | 17 | :urgency 'low |
14 | :transient t)) | 18 | :transient t)) |
15 | 19 | ||
20 | (defun +bongo-stop-all () | ||
21 | "Ensure only one bongo playlist is playing at a time. | ||
22 | This is intended to be :before advice to `bongo-play'." | ||
23 | (mapc (lambda (b) | ||
24 | (with-current-buffer b | ||
25 | (when-let* ((modep (derived-mode-p | ||
26 | 'bongo-playlist-mode)) | ||
27 | (bongo-playlist-buffer b) | ||
28 | (playingp (bongo-playing-p))) | ||
29 | (bongo-stop)))) | ||
30 | (buffer-list))) | ||
31 | |||
32 | |||
33 | ;;; Bongo Radio | ||
34 | |||
35 | (defcustom +bongo-radio-stations nil | ||
36 | "Stations to play using `+bongo-radio'.") | ||
37 | |||
38 | (defcustom +bongo-radio-buffer-name "*Bongo Radio*" | ||
39 | "Name of the buffer that holds all bongo radio stations." | ||
40 | :type 'string) | ||
41 | |||
42 | (defun +bongo-radio () | ||
43 | (interactive) | ||
44 | (switch-to-buffer (or (get-buffer +bongo-radio-buffer-name) | ||
45 | (+bongo-radio-init)))) | ||
46 | |||
47 | (defun +bongo-radio-init () | ||
48 | (interactive) | ||
49 | (let ((bongo-playlist-buffer (get-buffer-create +bongo-radio-buffer-name)) | ||
50 | (bongo-confirm-flush-playlist nil)) | ||
51 | (with-bongo-playlist-buffer | ||
52 | (bongo-playlist-mode) | ||
53 | (bongo-flush-playlist :delete-all) | ||
54 | (cl-loop for (name . url) in +bongo-radio-stations | ||
55 | do (bongo-insert-uri url name))) | ||
56 | (prog1 (switch-to-buffer bongo-playlist-buffer) | ||
57 | (goto-char (point-min))))) | ||
58 | |||
16 | (provide '+bongo) | 59 | (provide '+bongo) |
17 | ;;; +bongo.el ends here | 60 | ;;; +bongo.el ends here |