tweaks to empv

This commit is contained in:
Chris Cochrun 2025-07-14 12:54:41 -05:00
parent 0b9f2c5f8b
commit c661203887
2 changed files with 27 additions and 14 deletions

View file

@ -5070,6 +5070,9 @@ Let's use pdf-tools for a lot better interaction with pdfs.
#+end_src
** EMPV
:PROPERTIES:
:ID: 20250712T070328.619116
:END:
With empv we can perhaps control mpv much more fine grainly and even search youtube videos easier through emacs. Let's set it up.
#+begin_src emacs-lisp
(use-package empv
@ -5104,8 +5107,8 @@ With empv we can perhaps control mpv much more fine grainly and even search yout
"https://youtube.com/%s=%s"
(if video-id "watch?v" "playlist?list")
(or video-id playlist-id))))
(title (if file (shell-command-to-string
(format "yt-dlp --no-warnings --quiet --get-title %s" url))
(title (if file (string-trim (shell-command-to-string
(format "yt-dlp --no-warnings --quiet --get-title %s" url)))
(alist-get 'title item)))
(output-buffer (generate-new-buffer "*yt-dlp*"))
(process (progn
@ -5115,17 +5118,22 @@ 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]"
,(cl-coerce url 'string)
"--embed-thumbnail"
"--sponsorblock-remove=sponsor,intro,outro"))
(get-buffer-process output-buffer)))
(enqueue `(lambda (process event)
(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)
)))))
(progn (message "running empv shtuff because %s is %s" process event)
(message "%s is a string? %s" ,title (stringp ,title))
(let* ((files (directory-files
"/home/chris/vids/" t ,title nil 1))
(file (car files)))
(message "files is %s" files)
(message "file is %s" file)
(message "title is %s" ,title)
(empv-enqueue file))
(kill-buffer ,output-buffer))))))
(message url)
(if (process-live-p process)
(set-process-sentinel

19
init.el
View file

@ -3743,8 +3743,8 @@ targets."
"https://youtube.com/%s=%s"
(if video-id "watch?v" "playlist?list")
(or video-id playlist-id))))
(title (if file (shell-command-to-string
(format "yt-dlp --no-warnings --quiet --get-title %s" url))
(title (if file (string-trim (shell-command-to-string
(format "yt-dlp --no-warnings --quiet --get-title %s" url)))
(alist-get 'title item)))
(output-buffer (generate-new-buffer "*yt-dlp*"))
(process (progn
@ -3754,17 +3754,22 @@ targets."
:buffer output-buffer
:command `("yt-dlp" "-o"
"~/vids/%(title)s.%(ext)s"
"-f best[ext=mp4]"
,(cl-coerce url 'string)
"--embed-thumbnail"
"--sponsorblock-remove=sponsor,intro,outro"))
(get-buffer-process output-buffer)))
(enqueue `(lambda (process event)
(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)
)))))
(progn (message "running empv shtuff because %s is %s" process event)
(message "%s is a string? %s" ,title (stringp ,title))
(let* ((files (directory-files
"/home/chris/vids/" t ,title nil 1))
(file (car files)))
(message "files is %s" files)
(message "file is %s" file)
(message "title is %s" ,title)
(empv-enqueue file))
(kill-buffer ,output-buffer))))))
(message url)
(if (process-live-p process)
(set-process-sentinel