(Re)generate: (find-video-links-intro)
Source code:  (find-efunction 'find-video-links-intro)
More intros:  (find-eev-quick-intro)
This buffer is _temporary_ and _editable_.
It is meant as both a tutorial and a sandbox.

1. Introduction

Many of the tutorials of eev have "[Video links:]" blocks. For example: (find-eev-quick-intro "4. Creating Elisp Hyperlinks") (find-eev-quick-intro "4. Creating Elisp Hyperlinks" "[Video links:]") (find-eev-quick-intro "6. Controlling shell-like programs") (find-eev-quick-intro "6. Controlling shell-like programs" "[Video links:]") They contain links like these, (find-eevnavvideo "10:36" "if I type <f8> six times here") (find-eev2019video "15:11" "Demo: the eepitch block (in red star lines)") (find-eevtestblsvideo "2:33" "if I run f8 here I start a new Lua interpreter") that are "short links to eev video tutorials". These functions with names like `find-eev*video' are _sort of_ expanded to functions that specify explicitly which video on youtube to play, and where the local copy of the video can be found if we prefer to play the local copy. For the general idea of how this expansion is implemented, see: (find-eev-quick-intro "9. Shorter hyperlinks") (find-eev-quick-intro "9.1. `code-c-d'") (find-eev-quick-intro "9.1. `code-c-d'" "{c}") The strings "eevnav", "eev2019", and "eevtestbls" in the names of the functions correspond to the argument "c" of `code-c-d'.

2. From the HTML

The "intros" of eev can be read both from Emacs and from a browser. For example, the HTMLized version of this intro is at: http://anggtwu.net/eev-intros/find-video-links-intro.html In the HTMLized version each "short link to a video tutorial" has two hyperlinks, like this: (find-eev2020video "6:25" "`find-video'") \---------------/ \--/ function name: time: points to here points to (this section) YouTube the function name, "find-eev2020video", points to a place - this section! - with help about how these links work, and the timestamp, "6:25", points to YouTube; in this example, the "6:25" points to my presentation about eev in the EmacsConf2020, and it plays that video starting from 6:25. More precisely, the "6:25" points to: https://www.youtube.com/watch?v=hOAqBc42Gg8#t=6m25s \---------/ \---/ "hash" time We call the string "hOAqBc42Gg8" the "hash" of the video; calling it the "youtube id" of the video would be more precise, but longer. The "6:25" is converted to a "#t=6m25s", that makes youtube start playing the video from the right position.

3. `find-youtube-video'

In some situations - see the section 7 - running (find-eev2020video "6:25" "`find-video'") makes Emacs run this: (find-youtube-video "hOAqBc42Gg8" "6:25") Note that running this sexp (ee-find-youtube-video "hOAqBc42Gg8" "6:25") returns one of these sexps, (find-googlechrome "http://www.youtube.com/watch?v=hOAqBc42Gg8#t=6m25s") (find-firefox "http://www.youtube.com/watch?v=hOAqBc42Gg8#t=6m25s") according to the variable `ee-find-youtube-video-program'; you can configure it to use one of the most common browsers with: (setq ee-find-youtube-video-program 'find-googlechrome) (setq ee-find-youtube-video-program 'find-firefox)

4. Configuring the browser

The variables `ee-firefox-program' and `ee-googlechrome-program' determine the programs that `find-firefox' and `find-googlechrome' should try to execute. You can test if they are correct by trying: (find-firefox "http://www.lua.org/start.html") (find-googlechrome "http://www.lua.org/start.html") Typically on GNU/Linux systems the right values are: (setq ee-firefox-program "firefox") (setq ee-googlechrome-program "google-chrome") and on M$ Windows typically what works is something like: (setenv "FIREFOXDIR" "c:/Program Files/Mozilla Firefox") (setenv "GOOGLECHROMEDIR" "c:/Program Files/Google/Chrome/Application") (setq ee-firefox-program "$FIREFOXDIR/firefox.exe") (setq ee-googlechrome-program "$GOOGLECHROMEDIR/chrome.exe") but people usually have to adjust the paths by hand. One way to test if the paths are right is to open the directories in dired and see if the files "firefox.exe" and "chrome.exe" are there - i.e., run these sexps and see if they find the right files in the right directories: (find-fline "$FIREFOXDIR/" "firefox.exe") (find-fline "$GOOGLECHROMEDIR/" "chrome.exe") If you've never heard of dired, then read this: (find-enode "Dired")

5. Local copies

In some situations - see section 7 - a sexp like (find-eev2020video "6:25" "`find-video'") will try to play a local copy of the video file. In the case of `find-eev2020video' this means a local copy of this file, http://anggtwu.net/eev-videos/emacsconf2020.mp4 downloaded by `psne'-ing, as explained here: (find-psne-intro) The local copy will be played with Mpv, with: (find-mpv-video "$S/http/anggtwu.net/eev-videos/emacsconf2020.mp4" "6:25")

5.1. Subtitles

Some of the videos in http://anggtwu.net/eev-videos/ have subtitles in separate files. If a video called NAMEOFTHEVIDEO(.mp4) has subtitles in two formats, .srt and .srt, then the _low-level way_ to download it from the eev home page would be with this eepitch block: * (eepitch-shell2) * (eepitch-kill) * (eepitch-shell2) mkdir -p $S/http/anggtwu.net/eev-videos/ cd $S/http/anggtwu.net/eev-videos/ wget -nc http://anggtwu.net/eev-videos/NAMEOFTHEVIDEO.mp4 wget -N http://anggtwu.net/eev-videos/NAMEOFTHEVIDEO.srt wget -N http://anggtwu.net/eev-videos/NAMEOFTHEVIDEO.vtt The eepitch block above follows all the conventions that are explained here, (find-psne-intro "1. Local copies of files from the internet") except for the arguments to wget. The help message for wget explains "-nc" and "-N" as: (find-sh "wget --help" "-nc, --no-clobber") (find-sh "wget --help" "-N, --timestamping") -nc, --no-clobber skip downloads that would download to existing files (overwriting them) -N, --timestamping don't re-retrieve files unless newer than local The ".mp4"s at anggtwu.net are never updated, so if we already have a local copy of the .mp4 then wget shouldn't try to download it again. In contrast, subtitle files are revised occasionally, so if the subtitle files on anggtwu.net are newer than the local copy then wget should download the newer version, and overwrite the local subtitle files with their newer versions. The _medium-level way_ to download videos from anggtwu.net, with or without subtitles, is by running sexps like these ones: (find-psne-eevvideo-links "NAMEOFTHEVIDEO" "") (find-psne-eevvideo-links "NAMEOFTHEVIDEO" ".srt") (find-psne-eevvideo-links "NAMEOFTHEVIDEO" ".srt .vtt") Try them - they create temporary buffers with scripts like the one in the beginning of this section, but with different commands for downloading subtitles: the sexp with ".srt .vtt" creates a script that downloads two subtitle files, the one with ".srt" creates a script that downloads just one, and the sexp with "" creates a script that doesn't try to download any subtitle files. The _high-level way_ to play a first-class video is with sexps like this one - see section 9 for details: (find-eev2021video) The sexp above calls this one, (find-1stclassvideo-video "eev2021") that will play the local copy of the video if it exists, or download a local copy if we don't have a local copy of it yet. The entry about the video "eev2021" in the list of first-class videos is here: (find-eev "eev-videolinks.el" "eev2021") Try these sexps: (ee-1stclassvideos-mp4stem "eev2021") (ee-1stclassvideos-localmp4 "eev2021") (ee-1stclassvideos-mp4found "eev2021") (ee-1stclassvideos-field "eev2021" :subs) (ee-1stclassvideos-field "2021workshop5" :subs) You will see that the video "eev2021" has subtitles, and the video "2021workshop5" doesn't. NOTE: the support for subtitles is recent, and is still a bit rough. The temporary buffer generated by `find-1stclassvideo-links' contains a few extra lines when a video has subtitles - compare: (find-1stclassvideo-links "eev2021") (find-1stclassvideo-links "2021workshop5") but the process of downloading or updating subtitles is not well integrated in the rest of eev yet, and at this moment the "right" way to download or update subtitles is with `find-1stclassvideo-links' and with the link in its "Download subtitles" section.

6. Configuring Mpv

After installing Mpv you may have to configure its path. On GNU/Linux this typically works, (setq ee-mpv-program "mpv") and on M$ Windows you will need something like this, but you will have to adjust the path: (setenv "MPVDIR" "c:/Users/myusername/path/to/mpv") (setq ee-mpv-program "$MPVDIR/mpv.exe") You can test if the path is right with the two sexps below. Note that the first is for M$ Windows only, and that the second one will display the basic command-line options of mpv. (find-fline "$MPVDIR/" "mpv.exe") (find-callprocess `(,ee-mpv-program "--help"))

7. `find-eev-video'

All the standard functions for short links to video tutorials are implemented using a function called `find-eev-video'. For example, `find-eev2020video' is defined as: ;; For the real definition, see: ;; (find-eev "eev-audiovideo.el" "video-tutorials") ;; (find-eev "eev-audiovideo.el" "video-tutorials" "eev2020") ;; (defun find-eev2020video (&optional time &rest rest) "[Long docstring omitted]" (interactive) (find-eev-video "emacsconf2020" "hOAqBc42Gg8" time)) Calling: (find-eev2020video "6:25" "`find-video'") runs: (find-eev-video "emacsconf2020" "hOAqBc42Gg8" "6:25") that runs one of these sexps, depending on the current settings: (find-youtube-video "hOAqBc42Gg8" "6:25") (find-eevlocal-video "emacsconf2020" "hOAqBc42Gg8" "6:25") (find-eevlinks-video "emacsconf2020" "hOAqBc42Gg8" "6:25") The one with `find-eevlocal-video' plays the local copy of http://anggtwu.net/eev-videos/emacsconf2020.mp4 if it has already been downloaded, and if the local copy is not found it displays a temporary buffer with links and an e-script for downloading - i.e., psne-ing - the video from the URL above. The sexp with `find-eevlinks-video' works very similarly to the one with `find-eevlocal-video', but it always displays the temporary buffer with links and an e-script. You can select the behavior of `find-eev-video' - and thus the behavior of all short links to video tutorials, as they all call `find-eev-video' - by running one of the `setq's below: (setq ee-find-eev-video-function 'find-eevyoutube-video) (setq ee-find-eev-video-function 'find-eevlocal-video) (setq ee-find-eev-video-function 'find-eevlinks-video) `find-eevyoutube-video' is like `find-eev-video', but it discards its first argument. The default is `find-eevlocal-video', but for Windows users starting with `find-eevyoutube-video' makes more sense. The user-friendly way to select one of these behaviors is with these sexps: (ee-use-local-videos) (ee-use-youtube-videos) You can also run them with `M-x ee-use-local-videos' and `M-x ee-use-youtube-videos'.

8. Windows

This is my n-th different implementation of the innards of the short links to video tutorials. This one - from nov/2021 - was inspired by feedback of the Windows users that participated in this workshop: https://lists.gnu.org/archive/html/help-gnu-emacs/2021-10/msg00037.html https://lists.gnu.org/archive/html/help-gnu-emacs/2021-10/msg00045.html http://anggtwu.net/2021-oficina.html (<- in Portuguese) My original implementation - from may/2021 - was the one described here: http://anggtwu.net/2021-video-links.html I'm trying to making the short links to video tutorials work from Emacs _in a way that is convenient for both long-time users and total beginners_. This is quite a challenge - especially because since oct/2021 my notion of "total beginners" includes "people who use Windows and who have never used terminals in their lives". If you are one of those "total beginners" my recommendation is: start by this tutorial - it will force you to learn how to configure paths and how to test if Emacs knows how to call a given external program - and then follow this one: (find-windows-beginner-intro)

9. First-class videos

I store videos of several kinds in: http://anggtwu.net/eev-videos/ The presentations and tutorials on eev are the "first-class citizens" of that directory - mainly in the sense that a lot of information about them is available and easy to find. Let's look at one example in details. Try: (find-efunctiondescr 'find-eev2019video) (find-efunction 'find-eev2019video) (find-efunctionpp 'find-eev2019video) (find-1stclassvideo-links "eev2019") All these sexps "work" - they point to meaningful places. The data about these first-class videos is kept in the variable `ee-1stclassvideos-info', that is defined here: (find-eev "eev-videolinks.el" "ee-1stclassvideos-info") The most user-friendly way to access this data for a particular video is with a sexp with `find-1stclassvideo-links', like this one: (find-1stclassvideo-links "2022findeevangg") and the best and most user-friendly way to access the list of videos is by running `M-x find-1stclassvideos', or: (find-1stclassvideos) That function displays a temporary buffer with a list of all first-class videos, with a `find-1stclassvideo-links' sexp for each one. Here is a screenshot: http://anggtwu.net/IMAGES/2022find-1stclassvideos.png

10. Second-class videos

I will refer to the videos in http://anggtwu.net/eev-videos/ that are not "first-class citizens" as - ta-da! - "second class citizens". When I want to show something in one of those videos to a person who uses eev I send her sexps like these: (code-eevvideo "eevhydras" "2021-05-20_hydra_ei") (find-eevhydrasvideo "0:00") (find-eevhydrasvideo "0:50") If you run the sexps above and then these ones, (find-efunctiondescr 'find-eevhydrasvideo) (find-efunction 'find-eevhydrasvideo) (find-efunctionpp 'find-eevhydrasvideo) (find-1stclassvideo-links "eevhydras") you will see `find-eevhydrasvideo' is "not documented", that Emacs "Do(es)n't know where `find-eevhydrasvideo' is defined", that the pretty-printed version of `find-eevhydrasvideo' doesn't have a docstring after its argument list, and that many of the links in the temporary buffer created by `find-1stclassvideo-links' don't work. For more information on `code-eevvideo' see the comments in its source code, here: (find-eev "eev-videolinks.el" "second-class-videos") (find-eev "eev-videolinks.el" "code-eevvideo")

11. Hardcoded paths

Practically all the functions defined above have `eev' in their names, and they all convert the "{stem}" of a video to a URL like this: http://anggtwu.net/eev-videos/{stem}.mp4 The conversion from "{stem}" to "http://anggtwu.net/eev-videos/{stem}.mp4" is hardcoded in these functions, and AT THIS MOMENT there isn't an easy way to implement other similar conversions - pointing to other repositories of videos - without changing a lot of code by hand. This is mainly because I don't know anyone else who is putting their videos on places from which they are easy to wget. If you know something like this, please get in touch!