From cd4701072999e5bcfad701bd3ec7ce1ae62194e4 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 29 Apr 2025 14:58:00 -0500 Subject: [PATCH] fixing empv-yt-dlp --- README.org | 17 ++++++++++++----- init.el | 17 ++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/README.org b/README.org index 5d0c631c..8c2f2716 100644 --- a/README.org +++ b/README.org @@ -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) diff --git a/init.el b/init.el index 557d1c31..1dd372b3 100644 --- a/init.el +++ b/init.el @@ -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)