summaryrefslogtreecommitdiffhomepage
path: root/init.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-11-12 02:53:53 +0000
committerjao <jao@gnu.org>2021-11-12 02:54:28 +0000
commit0f755cffbd470508e4e8aea70e3253aaa5a61a5f (patch)
tree089b6d70f59ebe88286fae3581834e84dc16b180 /init.org
parent37ba723bc171ed3dd3c1986b593b74c622a1293f (diff)
downloadelibs-0f755cffbd470508e4e8aea70e3253aaa5a61a5f.tar.gz
elibs-0f755cffbd470508e4e8aea70e3253aaa5a61a5f.tar.bz2
browse-url handler for sound urls (mpc)
Diffstat (limited to 'init.org')
-rw-r--r--init.org10
1 files changed, 10 insertions, 0 deletions
diff --git a/init.org b/init.org
index 88cd745..6fe200e 100644
--- a/init.org
+++ b/init.org
@@ -1535,6 +1535,15 @@
(defun jao-elpher--browse (url &rest _) (elpher-go url))
+ (defvar jao-browse--sound-rx
+ (format "^https?://.*/.*\\.%s" (regexp-opt '("mp4" "mp3" "flv"))))
+
+ (defun jao-browse-add-url-to-mpc (url &rest _)
+ (let ((p (yes-or-no-p (format "Play %s right now?" url))))
+ (when p (jao-mpc-clear))
+ (jao-mpc-add-url url)
+ (if p (jao-mpc-play) (message "%s added to mpc queue" url))))
+
(setq browse-url-handlers
`(("^\\(gemini\\|gopher\\)://.*" . jao-elpher--browse)
(,jao--doc-exts . jao--browse-doc)
@@ -1543,6 +1552,7 @@
("^file://?" . jao--find-file-other-window)
(,jao-browse--external-regexp . ,jao-browse-url-external-function)
("^https?://.*\\.gotomeeting\\.com\\.*" . browse-url-chrome)
+ (,jao-browse--sound-rx . jao-browse-add-url-to-mpc)
(,(jao-wget--regexp) . jao-download)
(jao-video--url-p . jao-maybe-view-video)
("." . ,jao-browse-url-function)))