diff options
-rw-r--r-- | init.el | 67 | ||||
-rw-r--r-- | lisp/+bongo.el | 43 | ||||
-rw-r--r-- | lisp/+tab-bar.el | 24 |
3 files changed, 121 insertions, 13 deletions
diff --git a/init.el b/init.el index a510daf..6fa9adc 100644 --- a/init.el +++ b/init.el | |||
@@ -792,22 +792,69 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." | |||
792 | :host github | 792 | :host github |
793 | :repo "dbrock/bongo")) | 793 | :repo "dbrock/bongo")) |
794 | (:also-load +bongo) | 794 | (:also-load +bongo) |
795 | (:option bongo-default-directory "~/var/music") | 795 | (:option bongo-default-directory "~/var/music" |
796 | bongo-custom-backend-matchers '((mpv . (("https:") . t))) | ||
797 | +bongo-radio-stations ; use `+bongo-radio' for these | ||
798 | `(;; Local radio | ||
799 | ("KLSU" | ||
800 | . "http://130.39.238.143:8010/stream.mp3") | ||
801 | ("WRKF: NPR for the Capital Region" | ||
802 | . ,(concat "https://playerservices.streamtheworld.com/api/" | ||
803 | "livestream-redirect/WRKFFM.mp3")) | ||
804 | ("WRKF HD-2" | ||
805 | . ,(concat "https://playerservices.streamtheworld.com/api/" | ||
806 | "livestream-redirect/WRKFHD2.mp3")) | ||
807 | ("WBRH: Jazz & More" | ||
808 | . "http://wbrh.streamguys1.com/wbrh-mp3") | ||
809 | ("KBRH Blues & Rhythm Hits" | ||
810 | . "http://wbrh.streamguys1.com/kbrh-mp3") | ||
811 | ;; Soma FM | ||
812 | ("Soma FM Synphaera" | ||
813 | . "https://somafm.com/synphaera256.pls") | ||
814 | ("SomaFM BAGel Radio" | ||
815 | . "https://somafm.com/bagel.pls") | ||
816 | ("SomaFM Boot Liquor" | ||
817 | . "https://somafm.com/bootliquor320.pls") | ||
818 | ("SomaFM Deep Space One" | ||
819 | . "https://somafm.com/deepspaceone.pls") | ||
820 | ("SomaFM Fluid" | ||
821 | . "https://somafm.com/fluid.pls") | ||
822 | ("SomaFM Underground 80s" | ||
823 | . "https://somafm.com/u80s256.pls") | ||
824 | ;; Tildeverse & Friends | ||
825 | ("tilderadio" | ||
826 | . "https://azuracast.tilderadio.org/radio/8000/radio.ogg") | ||
827 | ("vantaradio" | ||
828 | . "https://vantaa.black/radio") | ||
829 | ;; Other online radio | ||
830 | ("BadRadio: 24/7 PHONK" | ||
831 | . "https://s2.radio.co/s2b2b68744/listen") | ||
832 | ("Cafe - lainon.life" | ||
833 | . "https://lainon.life/radio/cafe.ogg.m3u") | ||
834 | ("Everything - lainon.life" | ||
835 | . "https://lainon.life/radio/everything.ogg.m3u") | ||
836 | ("Swing - lainon.life" | ||
837 | . "https://lainon.life/radio/swing.ogg.m3u") | ||
838 | ("Cyberia - lainon.life" | ||
839 | . "https://lainon.life/radio/cyberia.ogg.m3u") | ||
840 | ("Nightwave Plaza - Online Vaporwave Radio" | ||
841 | . "http://radio.plaza.one/opus"))) | ||
842 | (advice-add 'bongo-play :before #'+bongo-stop-all) | ||
796 | (with-eval-after-load 'notifications | 843 | (with-eval-after-load 'notifications |
797 | (add-hook 'bongo-player-metadata-changed-hook #'+bongo-notify))) | 844 | (add-hook 'bongo-player-metadata-changed-hook #'+bongo-notify))) |
798 | 845 | ||
799 | (setup (:straight (cape | 846 | (setup (:straight (cape |
800 | :host github :repo "minad/cape")) | 847 | :host github :repo "minad/cape")) |
801 | (dolist (fn | 848 | (dolist (fn |
802 | ;; All available cape capfs listed here. Add them to the front since | 849 | ;; All available cape capfs listed here. Add them to the front since |
803 | ;; they're reversed with `add-to-list'. | 850 | ;; they're reversed with `add-to-list'. |
804 | '(cape-file | 851 | '(cape-file |
805 | cape-dabbrev | 852 | cape-dabbrev |
806 | cape-keyword | 853 | cape-keyword |
807 | cape-abbrev | 854 | cape-abbrev |
808 | cape-ispell | 855 | cape-ispell |
809 | ;;cape-dict | 856 | ;;cape-dict |
810 | )) | 857 | )) |
811 | (add-to-list 'completion-at-point-functions fn :append))))) | 858 | (add-to-list 'completion-at-point-functions fn :append))))) |
812 | 859 | ||
813 | (setup (:straight circe) | 860 | (setup (:straight circe) |
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 |
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 |