From 82ee45737d2af92ac583d6319d5589d3f0b61c9e Mon Sep 17 00:00:00 2001 From: JSDurand Date: Wed, 3 Mar 2021 11:08:34 +0800 Subject: Add some feeds and a filter for downloading. * elfeed-conf.el (elfeed-feeds): More feeds. (durand-eshell-download-filter): Replace the previous string before inserting new strings. (durand-elfeed-download-video): Reminds of the start of the download, and uses the filter. --- elfeed-conf.el | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/elfeed-conf.el b/elfeed-conf.el index 378ac9f..00893a2 100644 --- a/elfeed-conf.el +++ b/elfeed-conf.el @@ -30,6 +30,8 @@ (setq elfeed-feeds (list (list "https://wiwi.video/feeds/videos.atom?sort=-publishedAt" 'wiwi) + (list "https://wiwikuan.com/index.xml" + 'wiwi 'blog) (list "https://protesilaos.com/codelog.xml" 'prot 'code) (list "https://protesilaos.com/news.xml" @@ -41,7 +43,9 @@ (list "https://notrelated.xyz/rss" 'lukesmith 'notrelated) (list "https://lukesmith.xyz/peertube" - 'lukesmith 'youtube))) + 'lukesmith 'youtube) + (list "https://www.youtube.com/feeds/videos.xml?channel_id=UCiWXd0nmBjlKROwzMyPV-Nw" + 'zhichi 'youtube))) (define-key elfeed-search-mode-map (vector #x78) 'elfeed-search-exit) @@ -88,6 +92,19 @@ This informs the user when STATUS is the string \"finished\\n\"." (cond ((string-equal status "finished\n") (message "Downloading videos has finished.")))) +;;;###autoload +(defun durand-eshell-download-filter (process output) + "Display OUTPUT in the buffer associated with PROCESS. +By display it is meant that before inserting the ouput the buffer +will first be erased." + (let ((buffer (process-buffer process))) + (cond + (buffer + (with-current-buffer buffer + (erase-buffer) + (insert + (replace-regexp-in-string " \\|" "" output))))))) + ;;;###autoload (defun durand-elfeed-download-video () "Download the video in the feed." @@ -99,10 +116,12 @@ This informs the user when STATUS is the string \"finished\\n\"." ((derived-mode-p 'elfeed-show-mode) (setq link (elfeed-entry-link elfeed-show-entry))) ((user-error "Not in an elfeed buffer"))) + (message "Downloading starts.") (make-process :name "elfeed download video" :buffer "*elfeed download*" :sentinel #'durand-eshell-download-sentinel + :filter #'durand-eshell-download-filter :command (list "youtube-dl" "-f" "bestvideo[height<=720]+bestaudio/best[height<=720]/best" link)))) -- cgit v1.2.3-18-g5258