about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+bongo.el43
-rw-r--r--lisp/+tab-bar.el24
2 files changed, 64 insertions, 3 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
diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index 6567f67..c5a93dc 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el
@@ -65,8 +65,14 @@
65 65
66(defun +tab-bar-bongo () 66(defun +tab-bar-bongo ()
67 "Display Bongo now playing information." 67 "Display Bongo now playing information."
68 (when (and bongo-mode-line-indicator-mode 68 (when-let ((modep bongo-mode-line-indicator-mode)
69 (bongo-playing-p)) 69 (buf (cl-some (lambda (b)
70 (with-current-buffer b
71 (when-let* ((modep (derived-mode-p 'bongo-playlist-mode))
72 (bongo-playlist-buffer b)
73 (playingp (bongo-playing-p)))
74 b)))
75 (buffer-list))))
70 `((bongo-now-playing menu-item 76 `((bongo-now-playing menu-item
71 ,(concat "{" 77 ,(concat "{"
72 (let ((bongo-field-separator "")) 78 (let ((bongo-field-separator ""))
@@ -76,7 +82,19 @@
76 (bongo-formatted-infoset)) 82 (bongo-formatted-infoset))
77 (- +tab-bar-emms-max-length 2))) 83 (- +tab-bar-emms-max-length 2)))
78 "}") 84 "}")
79 bongo-pause/resume 85 (lambda () (interactive)
86 (let ((bongo-playlist-buffer
87 ;; XXX: I'm sure this is terribly inefficient
88 (cl-some (lambda (b)
89 (with-current-buffer b
90 (when-let* ((modep (derived-mode-p
91 'bongo-playlist-mode))
92 (bongo-playlist-buffer b)
93 (playingp (bongo-playing-p)))
94 b)))
95 (buffer-list))))
96 (with-bongo-playlist-buffer
97 (bongo-pause/resume))))
80 :help ,(funcall bongo-header-line-function))))) 98 :help ,(funcall bongo-header-line-function)))))
81 99
82(defvar +tab-bar-show-original nil 100(defvar +tab-bar-show-original nil