Emacs: Fallback on various folders in ambrevar/youtube-dl-url

master
Pierre Neidhardt 2018-12-19 10:26:33 +01:00
parent 69925afe96
commit 8aef55e2dc
1 changed files with 6 additions and 2 deletions

View File

@ -449,12 +449,16 @@ Each paragraph stand on its line."
If URL is nil, use URL at point."
(interactive)
(setq url (or url (thing-at-point-url-at-point)))
(let ((eshell-buffer-name "*youtube-dl*"))
(let ((eshell-buffer-name "*youtube-dl*")
(directory (expand-file-name (or (file-directory-p "~/temp")
(file-directory-p "~/Videos")
(file-directory-p "~/Downloads")
"."))))
(eshell)
(when (eshell-interactive-process)
(eshell t))
(eshell-interrupt-process)
(insert " cd ~/temp && youtube-dl " url)
(insert (format " cd '%s' && youtube-dl " directory) url)
(eshell-send-input)))
(provide 'functions)