[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eev 3bb1fa6 02/20: Added `code-eevvideo' and `code-psne
From: |
Stefan Monnier |
Subject: |
[elpa] externals/eev 3bb1fa6 02/20: Added `code-eevvideo' and `code-psnevideo'. |
Date: |
Mon, 4 Jan 2021 01:01:47 -0500 (EST) |
branch: externals/eev
commit 3bb1fa6773df28ac3ba43f939f1cdd0ca5c8b046
Author: Eduardo Ochs <eduardoochs@gmail.com>
Commit: Eduardo Ochs <eduardoochs@gmail.com>
Added `code-eevvideo' and `code-psnevideo'.
---
ChangeLog | 16 ++++++
VERSION | 4 +-
eev-audiovideo.el | 24 +++++++-
eev-intro.el | 97 ++++++++++++++++++++++++++++---
eev-pkg.el | 2 +-
eev-prepared.el | 3 +-
eev-tlinks.el | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
eev.el | 2 +-
8 files changed, 300 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bc429e4..5ca7d99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2020-10-18 Eduardo Ochs <eduardoochs@gmail.com>
+
+ * eev-tlinks.el (find-eevvideo-links, code-eevvideo)
+ (find-code-eevvideo, ee-code-eevvideo): new functions.
+
+ * eev-intro.el (find-audiovideo-intro): added two new sections:
+ "7. `code-psnevideo'" and "7.1. `code-eevvideo'".
+
+2020-10-17 Eduardo Ochs <eduardoochs@gmail.com>
+
+ * eev-tlinks.el (find-psnevideo-links, ee-psnevideo-links)
+ (ee-psnevideo-download-if-needed, ee-psnevideo-download)
+ (ee-psnevideo-download0): new functions.
+
+ * eev-audiovideo.el (ee-time-to-youtube-time): new function.
+
2020-10-16 Eduardo Ochs <eduardoochs@gmail.com>
* eev-pdflike.el: Rewrote most of the file to use the cleaner
diff --git a/VERSION b/VERSION
index 81f0500..f5a0898 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-Fri Oct 16 03:30:16 GMT 2020
-Fri Oct 16 00:30:16 -03 2020
+Fri Oct 23 00:29:44 GMT 2020
+Thu Oct 22 21:29:44 -03 2020
diff --git a/eev-audiovideo.el b/eev-audiovideo.el
index 19399d7..4c32d1f 100644
--- a/eev-audiovideo.el
+++ b/eev-audiovideo.el
@@ -19,7 +19,7 @@
;;
;; Author: Eduardo Ochs <eduardoochs@gmail.com>
;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
-;; Version: 2020jan03
+;; Version: 2020oct17
;; Keywords: e-scripts
;;
;; Latest version: <http://angg.twu.net/eev-current/eev-audiovideo.el>
@@ -474,6 +474,28 @@ See: (find-audiovideo-intro \"`eev-avadj-mode'\")"
;; Garbage?
+
+;; Tests: (ee-time-to-youtube-time "2")
+;; (ee-time-to-youtube-time "23")
+;; (ee-time-to-youtube-time "1:23")
+;; (ee-time-to-youtube-time "1:23:43")
+;;
+(defun ee-time-to-youtube-time (str)
+ "Convert strings like \"1:23\" to strings like \"#t=1m23s\".
+Supports the input formats \"ss\", \"mm:ss\", and \"hh:mm:ss\".
+If the input does not match any of these formats, return nil."
+ (save-match-data
+ (cond ((string-match "^\\([0-9]+\\)$" str)
+ (format "#t=%ss" (match-string 1 str)))
+ ((string-match "^\\([0-9]+\\):\\([0-9][0-9]\\)$" str)
+ (format "#t=%sm%ss" (match-string 1 str) (match-string 2 str)))
+ ((string-match "^\\([0-9]+\\):\\([0-9][0-9]\\):\\([0-9][0-9]\\)$"
str)
+ (format "#t=%sh%sm%ss" (match-string 1 str) (match-string 2 str)
+ (match-string 2 str))))))
+
+
+
+
;;;
;;; _ __ ___ _ __ ___ _ ___ ___
;;; | '_ ` _ \| '_ ` _ \(_) __/ __|
diff --git a/eev-intro.el b/eev-intro.el
index d88a205..238afc5 100644
--- a/eev-intro.el
+++ b/eev-intro.el
@@ -7607,8 +7607,8 @@ as soon as the download is finished.
-7. Downloading a local copy
-===========================
+6.1. Downloading a local copy
+-----------------------------
Place the point at hash in the URL below,
http://www.youtube.com/watch?v=abcdefghijk
@@ -7675,8 +7675,8 @@ of the video from Youtube.
-8. Guessing the title and extension
-===================================
+6.2. Guessing the title and extension
+-------------------------------------
Let's simulate what would happen after the eepitch script above -
Execute this:
@@ -7712,8 +7712,8 @@ components are the \"dir\", the \"title\", and the
\"hash\".
-9. The first lines regenerate the buffer
-========================================
+6.3. The first lines regenerate the buffer
+------------------------------------------
The arguments to `find-youtubedl-links' are:
(find-youtubedl-links DIR TITLE HASH EXT- STEM)
@@ -7750,8 +7750,8 @@ TITLE and EXT- are made nil.
-10. Selecting a directory
-=========================
+6.4. Selecting a directory
+--------------------------
The second block of lines in the `find-youtubedl-links' buffer
are used to let we switch the directory quickly. If we just
execute `M-x find-youtubedl-links' with the point on our example
@@ -7787,6 +7787,87 @@ To change the dir strings \"~/videos/\",
\"~/videos/tech/\", \"/tmp/videos/\",
buffers, change the variables `ee-youtubedl-dir', `ee-youtubedl-dir2',
`ee-youtubedl-dir3', `ee-youtubedl-dir4.'
+
+
+
+
+7. `code-psnevideo'
+===================
+If we execute these two sexps
+
+ (code-psnevideo
+ \"punchandjudy\"
+
\"http://angg.twu.net/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U.mp4\"
+ \"K6LmZ0A1s9U\")
+
+ (find-punchandjudyvideo \"1:27\")
+
+the `find-punchandjudyvideo' link will work in a way that is
+quite different from the one in the demo in section 4.3. It will
+open a temporary buffer in which the first line is a sexp - that
+calls `find-psnevideo-links' - that regenerates that buffer, and
+the second line is a low-level sexp like this, but in a single
+line,
+
+ (find-video
+
\"$S/http/angg.twu.net/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U.mp4\"
+ \"1:27\")
+
+that will play the local copy of the video starting from 1:27;
+this means to to use this sexp to play the video
+
+ (find-punchandjudyvideo \"1:27\")
+
+you have to first execute it with `M-e', then type the <down> key
+to go the second line, then type `M-e' again.
+
+The last part of that buffer will either be just a message saying
+
+ # Local file found. No need to download it again.
+
+or this message here,
+
+ # Local file not found!
+ # You need to run this:
+
+followed by an eepitch block that you can you use to download the
+MP4 file, like the one here:
+
+ (find-psne-intro \"1. Local copies of files from the internet\")
+
+The middle of that buffer will have other things, like a link
+like this
+
+ http://www.youtube.com/watch?v=K6LmZ0A1s9U#t=1m27s
+
+to the video on youtube, and a call to `code-video' that will
+redefine `find-punchandjudyvideo' to make it play the video
+directly instead of creating a temporary buffer containing a link
+to play it.
+
+
+
+7.1. `code-eevvideo'
+--------------------
+`code-eevvideo' is a variant of `code-psnevideo' that lets us use
+shorter sexps. If we call this,
+
+ (code-eevvideo \"eevnav\" \"M-x-list-packages-eev-nav\")
+
+it will add \"http://angg.twu.net/eev-videos/\" and \".mp4\" to
+the string \"M-x-list-packages-eev-nav\" and then call
+`code-psnevideo'. As the third argument was omitted it will be
+set to \"{youtubeid}\". I am using `code-eevvideo' as an
+experiment: when I need to send a short screencast to someone who
+uses eev I record the video, upload it to
+http://angg.twu.net/eev-videos/ - not to youtube - and send to
+the person a pair of sexps like these:
+
+ (code-eevvideo \"eevnav\" \"M-x-list-packages-eev-nav\")
+ (find-eevnavvideo \"0:00\")
+
+
+
" pos-spec-list)))
;; (find-audiovideo-intro)
diff --git a/eev-pkg.el b/eev-pkg.el
index 87b36f1..dc4434e 100644
--- a/eev-pkg.el
+++ b/eev-pkg.el
@@ -1,4 +1,4 @@
-(define-package "eev" "20190517" "Support for e-scripts (eepitch blocks, elisp
hyperlinks, etc)"
+(define-package "eev" "20201022" "Support for e-scripts (eepitch blocks, elisp
hyperlinks, etc)"
'((emacs "24.1"))
:keywords
'("lisp" "e-scripts")
diff --git a/eev-prepared.el b/eev-prepared.el
index a024b7d..c283c97 100644
--- a/eev-prepared.el
+++ b/eev-prepared.el
@@ -128,7 +128,8 @@ PRE and POST must be strings. See `ee-se-to-string' and
altfile fmode))
-
+;; See: (find-prepared-intro "1. Prepared shells")
+;;
(defun eev (s &optional e altfile)
"Save the region in `ee-file', or in ALTFILE if it is non-nil.
If S is a string write then write the string instead. See `ee-write'.
diff --git a/eev-tlinks.el b/eev-tlinks.el
index 71fc0f0..a37dac6 100644
--- a/eev-tlinks.el
+++ b/eev-tlinks.el
@@ -73,6 +73,10 @@
;; «.find-fossil-links» (to "find-fossil-links")
;; «.find-apt-get-source-links» (to "find-apt-get-source-links")
;; «.find-eev-video-links» (to "find-eev-video-links")
+;; «.find-psnevideo-links» (to "find-psnevideo-links")
+;; «.code-psnevideo» (to "code-psnevideo")
+;; «.code-eevvideo» (to "code-eevvideo")
+;; «.find-eevvideo-links» (to "find-eevvideo-links")
;;
;; «.find-latex-links» (to "find-latex-links")
;; «.find-lua-links» (to "find-lua-links")
@@ -1424,6 +1428,168 @@ echo
'http://angg.twu.net/eev-videos/{anggstem}.mp4' >> ~/.psne.log
+
+;;; _ _
+;;; _ __ ___ _ __ _____ _(_) __| | ___ ___
+;;; | '_ \/ __| '_ \ / _ \ \ / / |/ _` |/ _ \/ _ \
+;;; | |_) \__ \ | | | __/\ V /| | (_| | __/ (_) |
+;;; | .__/|___/_| |_|\___| \_/ |_|\__,_|\___|\___/
+;;; |_|
+;;
+;; «find-psnevideo-links» (to ".find-psnevideo-links")
+;; Skel: (find-find-links-links-new "psnevideo" "c url youtubeid time" "url")
+;; Test: (find-psnevideo-links "c333"
"http://angg.twu.net/2020.1-C3/C3_aula_3_video_3.mp4")
+;;
+(defun find-psnevideo-links (&optional c url youtubeid time &rest
pos-spec-list)
+"Visit a temporary buffer containing an e-script for downloading and playing
URL."
+ (interactive)
+ (setq c (or c "{c}"))
+ (setq url (or url "{url}"))
+ (setq youtubeid (or youtubeid "{youtubeid}"))
+ (setq time (or time "{time}"))
+ (apply
+ 'find-elinks
+ `((find-psnevideo-links ,c ,url ,youtubeid ,time ,@pos-spec-list)
+ ,(ee-psnevideo-links c url youtubeid time)
+ )
+ pos-spec-list))
+
+(defun ee-psnevideo-links (c url youtubeid time)
+ (let* ((fname (ee-shorten-file-name (ee-url-to-fname url)))
+ (dir (file-name-directory fname))
+ (youtubeurl (format "http://www.youtube.com/watch?v=%s" youtubeid))
+ (youtubetime (or (ee-time-to-youtube-time time) ""))
+ )
+ (concat
+ (ee-template0 "\
+# (find-video \"{fname}\" \"{time}\")
+# (find-video \"{fname}\")
+
+# (code-video \"{c}video\" \"{fname}\")
+# (find-{c}video \"{time}\")
+
+# {url}
+# (find-fline \"{dir}\")
+
+# (kill-new \"{youtubeurl}{youtubetime}\")
+# {youtubeurl}{youtubetime}
+
+") (ee-psnevideo-download-if-needed url))))
+
+(defun ee-psnevideo-download-if-needed (url)
+ (let* ((fname (ee-shorten-file-name (ee-url-to-fname url)))
+ (dir (file-name-directory fname)))
+ (if (file-exists-p (ee-expand fname))
+ "# Local file found. No need to download it again.\n"
+ (ee-psnevideo-download url))))
+
+(defun ee-psnevideo-download (url)
+ (concat "\
+# Local file not found!
+# You need to run this: \n
+" (ee-psnevideo-download0 url)))
+
+(defun ee-psnevideo-download0 (url)
+ (let* ((fname (ee-shorten-file-name (ee-url-to-fname url)))
+ (dir (file-name-directory fname)))
+ (ee-template0 "\
+ (eepitch-shell)
+ (eepitch-kill)
+ (eepitch-shell)
+mkdir -p {dir}
+cd {dir}
+wget -nc '{url}'
+echo '{url}' >> ~/.psne.log
+
+# (find-fline \"{dir}\")
+")))
+
+
+
+;;; _ _ _
+;;; ___ ___ __| | ___ _ __ ___ _ __ _____ _(_) __| | ___ ___
+;;; / __/ _ \ / _` |/ _ \_____| '_ \/ __| '_ \ / _ \ \ / / |/ _` |/ _ \/ _ \
+;;; | (_| (_) | (_| | __/_____| |_) \__ \ | | | __/\ V /| | (_| | __/ (_) |
+;;; \___\___/ \__,_|\___| | .__/|___/_| |_|\___| \_/ |_|\__,_|\___|\___/
+;;; |_|
+;;
+;; «code-psnevideo» (to ".code-psnevideo")
+;; See: (find-audiovideo-intro "7. `code-psnevideo'")
+
+(defun code-psnevideo (c url &optional youtubeid)
+ (eval (ee-read (ee-code-psnevideo c url youtubeid))))
+(defun find-code-psnevideo (&optional c url youtubeid &rest rest)
+ (setq c (or c "{c}"))
+ (setq url (or url "{url}"))
+ (setq youtubeid (or youtubeid "{youtubeid}"))
+ (find-estring-elisp (apply 'ee-code-psnevideo c url youtubeid rest)))
+(defun ee-code-psnevideo (c url youtubeid)
+ (ee-template0 "\
+;; (find-code-psnevideo \"{c}\" \"{url}\" \"{youtubeid}\")
+;; (code-psnevideo \"{c}\" \"{url}\" \"{youtubeid}\")
+;; (find-{c}video \"0:00\")
+
+(defun find-{c}video (&optional time &rest rest)
+ (find-psnevideo-links \"{c}\" \"{url}\" \"{youtubeid}\" time))
+"))
+
+
+;;; _ _ _
+;;; ___ ___ __| | ___ ___ _____ ____ _(_) __| | ___ ___
+;;; / __/ _ \ / _` |/ _ \_____ / _ \/ _ \ \ / /\ \ / / |/ _` |/ _ \/ _ \
+;;; | (_| (_) | (_| | __/_____| __/ __/\ V / \ V /| | (_| | __/ (_) |
+;;; \___\___/ \__,_|\___| \___|\___| \_/ \_/ |_|\__,_|\___|\___/
+;;;
+;; «find-eevvideo-links» (to ".find-eevvideo-links")
+;; Test: (find-eevvideo-links "eevnav" "M-x-list-packages-eev-nav" "0:00")
+;; Skel: (find-find-links-links-new "eevvideo" "c stem youtubeid time" "url")
+;;
+(defun find-eevvideo-links (&optional c stem youtubeid time &rest
pos-spec-list)
+"Visit a temporary buffer containing hyperlinks for eevvideo."
+ (interactive)
+ (setq c (or c "{c}"))
+ (setq stem (or stem "{stem}"))
+ (setq youtubeid (or youtubeid "{youtubeid}"))
+ (setq time (or time "{time}"))
+ (let* ((url (format "http://angg.twu.net/eev-videos/%s.mp4" stem)))
+ (apply
+ 'find-elinks
+ `((find-eevvideo-links ,c ,stem ,youtubeid ,time ,@pos-spec-list)
+ ;; Convention: the first sexp always regenerates the buffer.
+ ;; (find-efunction 'find-eevvideo-links)
+ ,(ee-psnevideo-links c url youtubeid time)
+ )
+ pos-spec-list)))
+
+;; «code-eevvideo» (to ".code-eevvideo")
+;; See: (find-audiovideo-intro "7.1. `code-eevvideo'")
+;; Test: (code-eevvideo "eevnav" "M-x-list-packages-eev-nav")
+;; (find-eevnavvideo "0:00")
+;;
+(defun code-eevvideo (c stem &optional youtubeid)
+ (eval (ee-read (ee-code-eevvideo c stem youtubeid))))
+(defun find-code-eevvideo (&optional c stem youtubeid &rest rest)
+ (setq c (or c "{c}"))
+ (setq stem (or stem "{stem}"))
+ (setq youtubeid (or youtubeid "{youtubeid}"))
+ (find-estring-elisp (apply 'ee-code-eevvideo c stem youtubeid rest)))
+(defun ee-code-eevvideo (c stem youtubeid)
+ (ee-template0 "\
+;; (find-code-eevvideo \"{c}\" \"{stem}\" \"{youtubeid}\")
+;; (code-eevvideo \"{c}\" \"{stem}\" \"{youtubeid}\")
+;; (find-{c}video \"0:00\")
+
+(defun find-{c}video (&optional time &rest rest)
+ (find-eevvideo-links \"{c}\" \"{stem}\" \"{youtubeid}\" time))
+"))
+
+
+
+
+
+
+
+
;;; __ _ _ _ _ _ _ _
;;; / _(_)_ __ __| | | | __ _| |_ _____ __ | (_)_ __ | | _____
;;; | |_| | '_ \ / _` |_____| |/ _` | __/ _ \ \/ /____| | | '_ \| |/ / __|
diff --git a/eev.el b/eev.el
index 38f9902..6fdad76 100644
--- a/eev.el
+++ b/eev.el
@@ -6,7 +6,7 @@
;; Package-Requires: ((emacs "24.1"))
;; Keywords: lisp e-scripts
;; URL: http://angg.twu.net/#eev
-;; Version: 20201013
+;; Version: 20201022
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
- [elpa] externals/eev updated (90678b4 -> 4386fbd), Stefan Monnier, 2021/01/04
- [elpa] externals/eev 3bb1fa6 02/20: Added `code-eevvideo' and `code-psnevideo'.,
Stefan Monnier <=
- [elpa] externals/eev 13f88c4 03/20: Fixed `find-mpv-video' and documented a bug in `find-man'., Stefan Monnier, 2021/01/04
- [elpa] externals/eev c95d15a 06/20: Added `eepitch-vterm'., Stefan Monnier, 2021/01/04
- [elpa] externals/eev c6ed5f7 01/20: Rewrote most of the file eev-pdflike.el., Stefan Monnier, 2021/01/04
- [elpa] externals/eev d73f329 04/20: Cleaned up and reorganized `find-youtubedl-links'., Stefan Monnier, 2021/01/04
- [elpa] externals/eev 121acfc 05/20: Added comments to `find-grep-links'., Stefan Monnier, 2021/01/04
- [elpa] externals/eev df4c21f 07/20: Added support for `M-7 M-e'., Stefan Monnier, 2021/01/04
- [elpa] externals/eev 5496a57 09/20: Added the file `README.org'., Stefan Monnier, 2021/01/04
- [elpa] externals/eev 19bad3a 12/20: Rewrote the docs for `find-extra-file-links' (`M-e M-h')., Stefan Monnier, 2021/01/04
- [elpa] externals/eev 01b2212 13/20: Rewrote `(find-anchors-intro)'., Stefan Monnier, 2021/01/04
- [elpa] externals/eev f256747 14/20: Rewrote `find-man' completely to fix a long-standing bug., Stefan Monnier, 2021/01/04