summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/emacs/modules/bd--browse.el32
1 files changed, 20 insertions, 12 deletions
diff --git a/.config/emacs/modules/bd--browse.el b/.config/emacs/modules/bd--browse.el
index 15823fa..f300162 100644
--- a/.config/emacs/modules/bd--browse.el
+++ b/.config/emacs/modules/bd--browse.el
@@ -35,6 +35,22 @@ icecat, or eww."
:type 'dummy
:action (lambda (_) (browse-url (concat ,url (selector-input)) ,pref))))
+(defun rip (url)
+ "Play URL (or search string) in mpv."
+ (message "Ludu %s" url)
+ (start-process "rip" nil
+ "mpv" "--force-window=yes"
+ (concat (if (string-match "https://.*" url)
+ "ytdl://"
+ "ytdl://ytsearch:") url)))
+
+(defun bd/selector-rip ()
+ "Selector source for streaming a video off of youtube."
+ (selector-candidate-create
+ "Search Immediate"
+ :type 'dummy
+ :action (lambda (_) (rip (selector-input)))))
+
(defun bd/selector-search ()
"Selector source for all search engines."
(selector-source-create
@@ -45,6 +61,8 @@ icecat, or eww."
(bd/search-candidate "Invidious" "https://inv.nadeko.net/search?q=" 0)
(bd/search-candidate "Urban Dictionary" "https://www.urbandictionary.com/define.php?term=" 2)
(bd/search-candidate "Archwiki" "https://wiki.archlinux.org/index.php?title=Special%3ASearch&search=" 2)
+
+ (bd/selector-rip)
(bd/search-candidate "Web" "" 3))))
(defun bd/browse-dispatcher ()
@@ -53,20 +71,10 @@ icecat, or eww."
(unwind-protect
(selector
(list (bd/selector-bookmarks)
- (bd/selector-search)))))
-
-(defun rip (url)
- "Play URL (or search string) in mpv."
- (interactive "sURL or search string: ")
- (message "Ludu %s" url)
- (start-process "rip" nil
- "mpv" "--force-window=yes"
- (concat (if (string-match "https://.*" url)
- "ytdl://"
- "ytdl://ytsearch:") url)))
+ (bd/selector-search)))))
(setopt browse-url-handlers
- `((,(regexp-opt '("youtube.com" "youtu.be" "vid.puffyan.us" "deezer.page")) .
+ `((,(regexp-opt '("youtube.com" "youtu.be" "vid.puffyan.us" "deezer.page" "deezer.com")) .
(lambda (url &rest _) (rip url))))
url-privacy-level '(email os emacs lastloc cookies))