* Add a new link type for video files
@ 2020-01-03 9:07 stardiviner
2020-01-03 20:02 ` Eduardo Ochs
2020-01-07 8:27 ` Nicolas Goaziou
0 siblings, 2 replies; 6+ messages in thread
From: stardiviner @ 2020-01-03 9:07 UTC (permalink / raw)
To: Org Mode
I write a patch to add new link type:
#+begin_example
[[video:/path/to/file.mp4::00:13:20]]
#+end_example
This will open video file in specific timestamp. And it is possible to add more
options in link. Like video player arguments.
I want to ask should I add this patch to Org Mode built-in?
Here is my patch source code:
#+begin_src emacs-lisp :file "ol-video.el"
;;; [[video:/path/to/file.mp4::00:13:20]]
(defcustom org-video-link-open-command "mplayer"
"Specify the program for openning video: link."
:type 'string)
(defvar org-video-link-extension-list '("avi" "rmvb" "ogg" "mp4" "mkv"))
(defun org-video-link-open (uri)
"Open video file `URI' with video player."
(let* ((list (split-string uri "::"))
(path (car list))
(start-timstamp (cadr list)))
(make-process
:command (list org-video-link-open-command
"-ss" start-timstamp
(expand-file-name (org-link-unescape path)))
:name "org-video-link")))
(defun org-video-complete-link (&optional arg)
"Create a video link using completion."
(let ((file (read-file-name "Video: " nil nil nil nil
#'(lambda (file)
(seq-contains-p
org-video-link-extension-list
(file-name-extension file)))))
(pwd (file-name-as-directory (expand-file-name ".")))
(pwd1 (file-name-as-directory (abbreviate-file-name
(expand-file-name ".")))))
(cond ((equal arg '(16))
(concat "video:"
(abbreviate-file-name (expand-file-name file))))
((string-match
(concat "^" (regexp-quote pwd1) "\\(.+\\)") file)
(concat "video:" (match-string 1 file)))
((string-match
(concat "^" (regexp-quote pwd) "\\(.+\\)")
(expand-file-name file))
(concat "video:"
(match-string 1 (expand-file-name file))))
(t (concat "video:" file)))))
(org-link-set-parameters "video"
:follow #'org-video-link-open
:complete #'org-video-complete-link)
#+end_src
--
[ stardiviner ]
I try to make every word tell the meaning what I want to express.
Blog: https://stardiviner.github.io/
IRC(freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Add a new link type for video files
2020-01-03 9:07 Add a new link type for video files stardiviner
@ 2020-01-03 20:02 ` Eduardo Ochs
2020-01-07 8:27 ` Nicolas Goaziou
1 sibling, 0 replies; 6+ messages in thread
From: Eduardo Ochs @ 2020-01-03 20:02 UTC (permalink / raw)
To: numbchild; +Cc: Org Mode
Hi Stardiviner,
just some quick comments on org-video-link-open...
Eev also has functions for opening audio/video files at certain time
offsets. They are called like this (with `C-e C-x C-e' or something
equivalent),
(find-video "~/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U.mp4")
(find-video "~/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U.mp4" "1:17")
and the sexps above pass these lists to start-process:
("mpv" "~/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U.mp4"
"--fs" "--osd-level=2")
("mpv" "~/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U.mp4"
"--start" "1:17"
"--fs" "--osd-level=2")
I use mpv instead of mplayer because this page at the Wikipedia
convinced me to:
https://en.wikipedia.org/wiki/Mpv_(media_player)
"--fs" means "full screen" and "--osd-level=2" shows the current time.
If you know other emacs packages that implement opening audio or video
files and skipping to a certain position please tell me - I would like
to mention them in the comments of eev-audiovideo.el. I mentioned your
previous message there, by the way! See:
https://github.com/edrx/eev/blob/UTF-8/eev-audiovideo.el#L55
http://angg.twu.net/eev-current/eev-audiovideo.el.html
http://angg.twu.net/eev-current/eev-audiovideo.el
Cheers,
Eduardo Ochs
http://angg.twu.net/#eev
http://angg.twu.net/emacsconf2019.html
On Fri, 3 Jan 2020 at 06:15, stardiviner <numbchild@gmail.com> wrote:
>
>
> I write a patch to add new link type:
>
> #+begin_example
> [[video:/path/to/file.mp4::00:13:20]]
> #+end_example
>
> This will open video file in specific timestamp. And it is possible to add more
> options in link. Like video player arguments.
>
> I want to ask should I add this patch to Org Mode built-in?
>
> Here is my patch source code:
>
> #+begin_src emacs-lisp :file "ol-video.el"
> ;;; [[video:/path/to/file.mp4::00:13:20]]
> (defcustom org-video-link-open-command "mplayer"
> "Specify the program for openning video: link."
> :type 'string)
>
> (defvar org-video-link-extension-list '("avi" "rmvb" "ogg" "mp4" "mkv"))
>
> (defun org-video-link-open (uri)
> "Open video file `URI' with video player."
> (let* ((list (split-string uri "::"))
> (path (car list))
> (start-timstamp (cadr list)))
> (make-process
> :command (list org-video-link-open-command
> "-ss" start-timstamp
> (expand-file-name (org-link-unescape path)))
> :name "org-video-link")))
>
> (defun org-video-complete-link (&optional arg)
> "Create a video link using completion."
> (let ((file (read-file-name "Video: " nil nil nil nil
> #'(lambda (file)
> (seq-contains-p
> org-video-link-extension-list
> (file-name-extension file)))))
> (pwd (file-name-as-directory (expand-file-name ".")))
> (pwd1 (file-name-as-directory (abbreviate-file-name
> (expand-file-name ".")))))
> (cond ((equal arg '(16))
> (concat "video:"
> (abbreviate-file-name (expand-file-name file))))
> ((string-match
> (concat "^" (regexp-quote pwd1) "\\(.+\\)") file)
> (concat "video:" (match-string 1 file)))
> ((string-match
> (concat "^" (regexp-quote pwd) "\\(.+\\)")
> (expand-file-name file))
> (concat "video:"
> (match-string 1 (expand-file-name file))))
> (t (concat "video:" file)))))
>
> (org-link-set-parameters "video"
> :follow #'org-video-link-open
> :complete #'org-video-complete-link)
> #+end_src
>
> --
> [ stardiviner ]
> I try to make every word tell the meaning what I want to express.
>
> Blog: https://stardiviner.github.io/
> IRC(freenode): stardiviner, Matrix: stardiviner
> GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Add a new link type for video files
2020-01-03 9:07 Add a new link type for video files stardiviner
2020-01-03 20:02 ` Eduardo Ochs
@ 2020-01-07 8:27 ` Nicolas Goaziou
2020-01-31 11:17 ` Bastien
1 sibling, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2020-01-07 8:27 UTC (permalink / raw)
To: stardiviner; +Cc: Org Mode
Hello,
stardiviner <numbchild@gmail.com> writes:
> I write a patch to add new link type:
>
> #+begin_example
> [[video:/path/to/file.mp4::00:13:20]]
> #+end_example
Thank you.
> This will open video file in specific timestamp. And it is possible to add more
> options in link. Like video player arguments.
>
> I want to ask should I add this patch to Org Mode built-in?
I don't have a strong opinion on this, but considering Emacs does not
provide any way to play videos out of the box, I think there is no point
in shipping this with Emacs.
It can be a useful extension in ELPA, though. I suggest to add export
facilities, too.
WDYT?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Add a new link type for video files
2020-01-07 8:27 ` Nicolas Goaziou
@ 2020-01-31 11:17 ` Bastien
2020-01-31 12:37 ` stardiviner
0 siblings, 1 reply; 6+ messages in thread
From: Bastien @ 2020-01-31 11:17 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode
Hi Stardiviner,
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> I don't have a strong opinion on this, but considering Emacs does not
> provide any way to play videos out of the box, I think there is no point
> in shipping this with Emacs.
agreed. But this is a also nice feature (provided it does not depend
on the presence of mplayer only) -- if you find a way to publish this
code and advertize it on Worg, please go ahead.
We should work on making Worg more readable and efficient in promoting
external Org libraries - there are tons of them in the wild.
Thanks,
--
Bastien
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Add a new link type for video files
2020-01-31 11:17 ` Bastien
@ 2020-01-31 12:37 ` stardiviner
2020-01-31 16:23 ` Bastien
0 siblings, 1 reply; 6+ messages in thread
From: stardiviner @ 2020-01-31 12:37 UTC (permalink / raw)
To: Bastien; +Cc: Org Mode, Nicolas Goaziou
Bastien <bzg@gnu.org> writes:
> Hi Stardiviner,
>
> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
>> I don't have a strong opinion on this, but considering Emacs does not
>> provide any way to play videos out of the box, I think there is no point
>> in shipping this with Emacs.
>
> agreed. But this is a also nice feature (provided it does not depend
> on the presence of mplayer only) -- if you find a way to publish this
> code and advertize it on Worg, please go ahead.
>
> We should work on making Worg more readable and efficient in promoting
> external Org libraries - there are tons of them in the wild.
>
> Thanks,
Ok, I will push code and tutorial to Worg. I remember I added once for ob-clojure-literate.el.
Thanks Bastien
--
[ stardiviner ]
I try to make every word tell the meaning what I want to express.
Blog: https://stardiviner.github.io/
IRC(freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-01-31 16:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-03 9:07 Add a new link type for video files stardiviner
2020-01-03 20:02 ` Eduardo Ochs
2020-01-07 8:27 ` Nicolas Goaziou
2020-01-31 11:17 ` Bastien
2020-01-31 12:37 ` stardiviner
2020-01-31 16:23 ` Bastien
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).