fixing empv-yt-dlp

This commit is contained in:
Chris Cochrun 2025-04-29 14:58:00 -05:00
parent 2a45a5decf
commit cd47010729
2 changed files with 24 additions and 10 deletions

View file

@ -5082,7 +5082,10 @@ With empv we can perhaps control mpv much more fine grainly and even search yout
(let* ((item (when (not file) (empv-youtube-results--current-item)))
(video-id (when (not file) (alist-get 'videoId item)))
(playlist-id (when (not file) (alist-get 'playlistId item)))
(url (if file (progn (message file) (string-replace "inv.cochrun.xyz" "youtube.com" file))
(url (if file
(progn
(message file)
(string-replace "inv.cochrun.xyz" "youtube.com" file))
(format
"https://youtube.com/%s=%s"
(if video-id "watch?v" "playlist?list")
@ -5098,21 +5101,25 @@ With empv we can perhaps control mpv much more fine grainly and even search yout
:buffer output-buffer
:command `("yt-dlp" "-o"
"~/vids/%(title)s.%(ext)s"
;; "-f best[ext=mp4]"
"-f best[ext=mp4]"
,(cl-coerce url 'string)
"--embed-thumbnail"
"--sponsorblock-remove=sponsor,intro,outro"))
(get-buffer-process output-buffer)))
(enqueue `(lambda (process event)
(progn (message "running %s because %s" process event)
(empv-enqueue (concat "/home/chris/vids/" (string-trim ,title) ".mp4"))
(kill-buffer output-buffer)))))
(when (eq (process-status process) 'exit)
(progn (message "running %s because %s" process event)
(empv-enqueue (concat "/home/chris/vids/" (string-trim ,title) ".mp4"))
;; (kill-buffer ,output-buffer)
)))))
(message url)
(if (process-live-p process)
(set-process-sentinel
process enqueue)
(message "No process running"))))
;; (chris/empv-yt-dlp "https://inv.cochrun.xyz/watch?v=mNYcUMZfSP0")
(defun chris/empv-yt-dlp-jellyfin ()
"Grabs the current video at point and downloads it to my jellyfin server"
(interactive)

17
init.el
View file

@ -3726,7 +3726,10 @@ targets."
(let* ((item (when (not file) (empv-youtube-results--current-item)))
(video-id (when (not file) (alist-get 'videoId item)))
(playlist-id (when (not file) (alist-get 'playlistId item)))
(url (if file (progn (message file) (string-replace "inv.cochrun.xyz" "youtube.com" file))
(url (if file
(progn
(message file)
(string-replace "inv.cochrun.xyz" "youtube.com" file))
(format
"https://youtube.com/%s=%s"
(if video-id "watch?v" "playlist?list")
@ -3742,21 +3745,25 @@ targets."
:buffer output-buffer
:command `("yt-dlp" "-o"
"~/vids/%(title)s.%(ext)s"
;; "-f best[ext=mp4]"
"-f best[ext=mp4]"
,(cl-coerce url 'string)
"--embed-thumbnail"
"--sponsorblock-remove=sponsor,intro,outro"))
(get-buffer-process output-buffer)))
(enqueue `(lambda (process event)
(progn (message "running %s because %s" process event)
(empv-enqueue (concat "/home/chris/vids/" (string-trim ,title) ".mp4"))
(kill-buffer output-buffer)))))
(when (eq (process-status process) 'exit)
(progn (message "running %s because %s" process event)
(empv-enqueue (concat "/home/chris/vids/" (string-trim ,title) ".mp4"))
;; (kill-buffer ,output-buffer)
)))))
(message url)
(if (process-live-p process)
(set-process-sentinel
process enqueue)
(message "No process running"))))
;; (chris/empv-yt-dlp "https://inv.cochrun.xyz/watch?v=mNYcUMZfSP0")
(defun chris/empv-yt-dlp-jellyfin ()
"Grabs the current video at point and downloads it to my jellyfin server"
(interactive)