about summary refs log tree commit diff stats
path: root/lisp/+bongo.el
diff options
context:
space:
mode:
authorCase Duckworth2022-02-07 17:09:32 -0600
committerCase Duckworth2022-02-07 17:09:41 -0600
commit801ee6ec245a8a2fffdd81f256eab750634306fc (patch)
treea43984b5a38658c6054a01328485ca219b0e9f42 /lisp/+bongo.el
parentRemove emms (diff)
downloademacs-801ee6ec245a8a2fffdd81f256eab750634306fc.tar.gz
emacs-801ee6ec245a8a2fffdd81f256eab750634306fc.zip
Add +bongo-radio
Diffstat (limited to 'lisp/+bongo.el')
-rw-r--r--lisp/+bongo.el43
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.
22This 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