Next: Add auto-yt-dl-handler and auto-proxy-handler.
parent
bae6941aa5
commit
a784d64b52
|
@ -4,7 +4,23 @@
|
|||
(setf (get-default 'port 'path)
|
||||
"~/common-lisp/next/ports/gtk-webkit/next-gtk-webkit")
|
||||
|
||||
(defun old-reddit-hook (url)
|
||||
(defvar +youtube-dl-command+ "youtube-dl"
|
||||
"Path to the 'youtube-dl' program.")
|
||||
|
||||
(defun auto-yt-dl-handler (url)
|
||||
"Download a Youtube URL asynchronously to /tmp/videos/.
|
||||
Videos are downloaded with `+youtube-dl-command+'."
|
||||
(let ((uri (quri:uri url)))
|
||||
(when (and uri
|
||||
(member-string (quri:uri-domain uri) '("youtube.com" "youtu.be"))
|
||||
(string= (quri:uri-path uri) "/watch"))
|
||||
(log:info "Youtube: downloading ~a" url)
|
||||
(uiop:launch-program (list +youtube-dl-command+ url "-o" "/tmp/videos/%(title)s.%(ext)s"))))
|
||||
url)
|
||||
|
||||
;; (add-to-default-list #'auto-yt-dl-handler 'buffer 'load-hook)
|
||||
|
||||
(defun old-reddit-handler (url)
|
||||
(let* ((uri (quri:uri url)))
|
||||
(if (search "www.reddit" (quri:uri-host uri))
|
||||
(progn
|
||||
|
@ -13,7 +29,7 @@
|
|||
(log:info "Switching to old Reddit: ~a" new-url)
|
||||
new-url))
|
||||
url)))
|
||||
(add-to-default-list #'old-reddit-hook 'buffer 'load-hook)
|
||||
(add-to-default-list #'old-reddit-handler 'buffer 'load-hook)
|
||||
|
||||
(defun blocker-hook (url)
|
||||
(match (quri:uri-host (quri:uri url))
|
||||
|
@ -21,6 +37,22 @@
|
|||
url)
|
||||
(add-to-default-list #'blocker-hook 'buffer 'load-hook)
|
||||
|
||||
|
||||
(defvar *my-unproxied-domains*
|
||||
'("jit.si"
|
||||
"wikipedia.org"))
|
||||
|
||||
(defun auto-proxy-handler (url)
|
||||
(let* ((uri (quri:uri url))
|
||||
(domain (and uri (quri:uri-domain uri))))
|
||||
(when domain
|
||||
(next/proxy-mode:proxy-mode
|
||||
:activate
|
||||
(not (member-string domain *my-unproxied-domains*)))))
|
||||
url)
|
||||
|
||||
(add-to-default-list #'auto-proxy-handler 'buffer 'load-hook)
|
||||
|
||||
(setf (get-default 'remote-interface 'download-directory)
|
||||
"~/temp")
|
||||
|
||||
|
|
Loading…
Reference in New Issue