Closed emacsbliss closed 7 months ago
There isn't a download option in elfeed-tube yet, although I'm considering adding one.
It won't help with choppy playback though, unless you're willing to wait until the video is fully downloaded. If mpv playback is not smooth I would consider tweaking the variables cache
, cache-secs
, cache-pause-wait
, cache-pause-initial
and demuxer-max-bytes
in your mpv.conf instead.
thanks for the explanation, makes sense! I'll give it a try.. It would still be nice to have download option so I can leave it to download first and come back later once it's completed.
A download option would be nice. Having a download option you would want a configurable location(s) to download and search from. ex "~/youtube/channel/playlist/video.mkv". Something on the UI to indicate if the file is downloaded in the Elfeed post entry and maybe the Elfeed search UI, maybe the size as well. As well as some commands to download and delete, hopefully operating non the search UI and post UI.
A download option would be nice. Having a download option you would want a...
I'm considering a limited version of this, with the following considerations:
Something on the UI to indicate if the file is downloaded in the Elfeed post entry and maybe the Elfeed search UI,
elfeed-show-refresh-function
specifies the function that draws the elfeed show buffer. Its default value is elfeed-show-refresh--mail-style
, which produces the elfeed-show buffer that you see with the mail headers. Elfeed-tube's UI has a hard dependency on this. Other packages can write their own versions of this (here's an example of a different style) and elfeed-tube will break completely if you try it with them.As well as some commands to download and delete, hopefully operating non the search UI and post UI.
I'm not sure if I'll be able to get to it though. (PRs welcome!)
I've been using this command to download videos -- note that despite the name, it doesn't require elfeed-tube
or elfeed-tube-mpv
, only Emacs 28.1+ and yt-dlp
installed on the system.
(defun my/elfeed-tube-download (entries)
(interactive
(list
(cond
((eq major-mode 'elfeed-search-mode)
(when (y-or-n-p "Download entry at point or selected entries?")
(ensure-list (elfeed-search-selected))))
((eq major-mode 'elfeed-show-mode)
(when (y-or-n-p "Download entry at point or selected entries?")
(ensure-list elfeed-show-entry)))
(t (user-error "elfeed-tube-download only works in Elfeed.")))))
(when entries
(if-let* (((seq-every-p #'elfeed-tube--youtube-p entries))
(default-directory "~/Videos/yt/"))
(seq-doseq (entry entries)
(let* ((title (elfeed-entry-title entry))
(link (elfeed-entry-link entry))
(proc (start-process
(format "yt-dlp download: %s" title)
(get-buffer-create (format "*elfeed-tube-yt-dlp*: %s" title))
"yt-dlp" "-w" "-c" "-o" "%(title)s.%(ext)s" "-f"
"bestvideo[height<=?720]+bestaudio/best" "--add-metadata" link)))
(set-process-sentinel
proc
(lambda (process s)
(unless (process-live-p process)
(if (eq (process-exit-status process) 0)
(progn
(message "Finished download: %s" title)
(kill-buffer (process-buffer process)))
(message "Download: [%s] failed (%d) with error: %s"
title (process-exit-status process) s)))))
(message "Started download: %s" title)))
(message "Not youtube url(s), cancelling download."))))
You might want to change is the default destination (~/Videos/yt/
above).
Would be nice if the function posted by @karthink was modified to 1) not require user interaction after it is called (unnecessary), 2) skip downloading if the video is already there, and 3) Mark the entry as read.
Didn't find anywhere in the readme mention this, just wondering is video saved locally? Since playback initially is not smooth, wonder would it be better after sometime if video will be cached locally...