Elfeed: Add elfeed-download-with-youtube-dl.

master
Pierre Neidhardt 2020-09-27 13:00:12 +02:00
parent 0588198194
commit 49334c5c87
1 changed files with 10 additions and 1 deletions

View File

@ -30,6 +30,15 @@
(setq quality-arg (format "--ytdl-format=[height<=?%s]" quality-val)))
(start-process "elfeed-mpv" nil "mpv" quality-arg (elfeed-entry-link entry))))
(defun ambrevar/elfeed-download-with-youtube-dl ()
"Download entry with youtube-dl."
(interactive)
(let ((entry (if (eq major-mode 'elfeed-show-mode) elfeed-show-entry (elfeed-search-selected :single)))
(default-directory (expand-file-name "~/Downloads")))
;; TODO: Use ytdl.
(message "Downloading %s with youtube-dl..." (elfeed-entry-link entry))
(start-process "elfeed-youtube-dl" nil "youtube-dl" "-f" "best" (elfeed-entry-link entry))))
(defun ambrevar/elfeed-open-with-eww ()
"Open in eww with `eww-readable'."
(interactive)
@ -38,7 +47,7 @@
(add-hook 'eww-after-render-hook 'eww-readable nil t)))
(defvar ambrevar/elfeed-visit-patterns
'(("//[^/]*youtu\\.?be" . ambrevar/elfeed-play-with-mpv)
'(("//[^/]*youtu\\.?be" . ambrevar/elfeed-download-with-youtube-dl)
("phoronix" . ambrevar/elfeed-open-with-eww))
"List of (regexps . function) to match against elfeed entry link to know
whether how to visit the link.")