|
Exploring the innards of subed-mpv with eev
Sacha Chua's subed package can do some amazing things, like talking to an mpv process via a socket,
and displaying waveforms... but I'm a very bad user, and so my main interest was on subed's
low-level functions - and in 2024may11 I finally wrote a way to
explore them. It looks like this:
Note that in that screenshot we are editing a .vtt file in
subed-vtt mode, and we have a huge test block in
it; it was inserted by typing M-x eeit. The setup for
getting at that point is not trivial - we need to:
- clone the git repository of subed,
- load its .el files,
- download a video and its subtitles in .vtt in a temporary directory,
- set the Emacs window to fullheight mode and to a certain width,
- configure subed-mpv to use a certain geometry for the mpv window,
- visit the .vtt file,
- type M-x eeit in the right place to insert the test block,
- and then run the test block.
How can we do that with "executable notes", and without black boxes? Answer: run M-x
find-subed-mpv-links - it will show a temporary buffer containing this:
# (find-subed-mpv-links 140)
# (find-subed-mpv-links "{emacs-width}")
# (find-efunction 'find-subed-mpv-links)
# (find-efunction 'ee-insert-test-subed-vtt-mode)
# (find-eevfile "eev-testblocks.el" "ee-insert-test-subed-vtt-mode")
1. Get the video
================
Make sure that you have a local copy of this video:
(find-1stclassvideo-links "eev2021")
(find-eev2021video)
2. Prepare /tmp/subed-test/
===========================
The default for `ee-git-dir' is:
(setq ee-git-dir "~/usrc/")
Here we will use "/tmp/subed-test/".
# (setq ee-git-dir "/tmp/subed-test/")
# (find-git-links "https://github.com/sachac/subed" "subed")
# https://github.com/sachac/subed
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rfv /tmp/subed-test/
mkdir /tmp/subed-test/
cd /tmp/subed-test/
cp -v $S/http/anggtwu.net/eev-videos/emacsconf2021.mp4 a.mp4
cp -v $S/http/anggtwu.net/eev-videos/emacsconf2021.vtt a.vtt
cd /tmp/subed-test/
git clone https://github.com/sachac/subed
cd /tmp/subed-test/subed/
# (setq ee-git-dir "~/usrc/")
3. Load subed
=============
Run the red star lines below.
To load subed from another place, skip the
`add-to-list' in the first line.
* (add-to-list 'load-path "/tmp/subed-test/subed/subed/")
* (ee-locate-library "subed.el")
*
* (require 'subed)
* (require 'subed-mpv)
* (require 'subed-vtt)
* (code-c-d "subed" "/tmp/subed-test/subed/")
* (code-c-d "subeds" "/tmp/subed-test/subed/subed/")
* (code-c-d "subeds" (ee-locate-library "subed.el"))
*
** (find-subedfile "")
** (find-subedsfile "")
4. A test block in a .vtt
=========================
If everything is right then opening the "a.vtt" with the
last sexp below will put it in subed-vtt-mode. Many of the
sexps below are optional.
* (setq subed-auto-find-video t)
* (setq subed-auto-find-video nil)
* (setq subed-mpv-arguments '("--osd-level=2" "--geometry=320x200-0+0"))
* (set-frame-parameter (selected-frame) 'fullscreen 'fullheight)
* (set-frame-position (selected-frame) 0 0)
* (set-frame-parameter (selected-frame) 'width 140)
** (find-fline "/tmp/subed-test/")
* (find-fline "/tmp/subed-test/a.vtt")
Typing `M-x eeit' between two subtitles will insert a big test block
in the .vtt. To run that test block, just type <f8>s on its red star
lines.
|
If you have some experience with eev then these instructions should
be trivial to follow; but if you need some handholding, please don't hesitate to ask for help!
(Announcements: eev mailing list, Emacs
News blog post and tangents)
|