rice

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 4618932b2ff4dc8fc1a207d5e9864eed92e7049f
parent 86a176e4f91c0156dc671a16f4b9744e1e650578
Author: Mark Feller <mjfeller1992@gmail.com>
Date:   Fri, 14 Aug 2020 17:53:02 -0600

add elfeed helper functions

Diffstat:
Mdots/.emacs.d/modules/module-elfeed.el | 27+++++++++++++++++++++++++++
1 file changed, 27 insertions(+), 0 deletions(-)

diff --git a/dots/.emacs.d/modules/module-elfeed.el b/dots/.emacs.d/modules/module-elfeed.el @@ -31,6 +31,10 @@ "bestvideo[height<=?720][fps<=?30]+bestaudio/best" "Video and audio format for downloaded youtube content") +(defvar mjf/ytdl-audo-format + "--extract-audio --audio-quality 0 --audio-format flac" + "Youtube Download audio format flags") + (defun mjf/play-video-at-point () "Play the link at point with mpv" (interactive) @@ -38,6 +42,13 @@ mjf/elfeed-ytdl-format (thing-at-point 'url)))) +(defun mjf/ytdl-audio (url) + "Download a youtube video as audio" + (let ((default-directory "~/Downloads")) + (async-shell-command (format "youtube-dl %s '%s'" + mjf/ytdl-audo-format + url)))) + (defun mjf/yt-channel-feed (channel) "Create an elfeed feed for a given YouTube channel" (let ((feed (format "https://www.youtube.com/feeds/videos.xml?channel_id=%s" @@ -50,10 +61,26 @@ playlist))) `(,feed youtube))) +(defun mjf/elfeed-search-download-audio () + "Visit the current entry in your browser using `browse-url'. +If there is a prefix argument, visit the current entry in the +browser defined by `browse-url-generic-program'." + (interactive) + (let ((entries (elfeed-search-selected))) + (cl-loop for entry in entries + do (elfeed-untag entry 'unread) + when (elfeed-entry-link entry) + do (mjf/ytdl-audio it)) + (mapc #'elfeed-search-update-entry entries) + (unless (or elfeed-search-remain-on-entry (use-region-p)) + (forward-line)))) + (use-package elfeed :bind (:map elfeed-show-mode-map ("C-c o" . mjf/play-video-at-point)) + (:map elfeed-search-mode-map + ("a" . mjf/elfeed-search-download-audio)) :config (setq elfeed-db-directory "~/.local/share/elfeed")