summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--elfeed-conf.el34
-rw-r--r--eshell-conf.el2
2 files changed, 35 insertions, 1 deletions
diff --git a/elfeed-conf.el b/elfeed-conf.el
index 6ae8b41..378ac9f 100644
--- a/elfeed-conf.el
+++ b/elfeed-conf.el
@@ -76,5 +76,39 @@
(kill-buffer buffer)))))
(buffer-list)))
+;;;###autoload
+(defun durand-eshell-download-sentinel (process status)
+ "Inform the user when the download process is terminated.
+PROCESS should have the name \"elfeed download video\".
+
+This informs the user when STATUS is the string \"finished\\n\"."
+ (cond ((string-equal (process-name process) "elfeed download video"))
+ ((error "The download sentinel is applied to a wrong process: %S"
+ process)))
+ (cond ((string-equal status "finished\n")
+ (message "Downloading videos has finished."))))
+
+;;;###autoload
+(defun durand-elfeed-download-video ()
+ "Download the video in the feed."
+ (interactive)
+ (let ((default-directory "/Users/durand/Desktop/Centre/Vidéos/")
+ link)
+ (cond ((derived-mode-p 'elfeed-search-mode)
+ (setq link (elfeed-entry-link (elfeed-search-selected :ignore-region))))
+ ((derived-mode-p 'elfeed-show-mode)
+ (setq link (elfeed-entry-link elfeed-show-entry)))
+ ((user-error "Not in an elfeed buffer")))
+ (make-process
+ :name "elfeed download video"
+ :buffer "*elfeed download*"
+ :sentinel #'durand-eshell-download-sentinel
+ :command (list
+ "youtube-dl" "-f" "bestvideo[height<=720]+bestaudio/best[height<=720]/best"
+ link))))
+
+(define-key elfeed-search-mode-map (vector ?w) #'durand-elfeed-download-video)
+(define-key elfeed-show-mode-map (vector ?w) #'durand-elfeed-download-video)
+
(provide 'elfeed-conf)
;;; elfeed-conf.el ends here
diff --git a/eshell-conf.el b/eshell-conf.el
index a1bdf68..6bb255a 100644
--- a/eshell-conf.el
+++ b/eshell-conf.el
@@ -73,7 +73,7 @@ directory is used."
(directory-file-name
(file-name-directory default-directory))))))
(eshell-command-result
- (format "ln -sf %s %s"
+ (format "ln -sf \"%s\" \"%s\""
default-directory (expand-file-name args eshell-mark-directory))))
;;;###autoload