From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Alan E. Davis" Subject: Re: Audio/video file playback in org mode Date: Sun, 12 Jun 2011 09:55:43 +1000 Message-ID: References: <87oc24mqrd.fsf@mean.albasani.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=000e0cd6668ec799d304a5786d44 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:56079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QVY2B-0005Uz-00 for emacs-orgmode@gnu.org; Sat, 11 Jun 2011 19:56:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QVY29-0006Wl-5s for emacs-orgmode@gnu.org; Sat, 11 Jun 2011 19:56:06 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:42905) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QVY28-0006WZ-RM for emacs-orgmode@gnu.org; Sat, 11 Jun 2011 19:56:05 -0400 Received: by wyf19 with SMTP id 19so3141603wyf.0 for ; Sat, 11 Jun 2011 16:56:03 -0700 (PDT) In-Reply-To: <87oc24mqrd.fsf@mean.albasani.net> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Memnon Anon Cc: emacs-orgmode@gnu.org --000e0cd6668ec799d304a5786d44 Content-Type: text/plain; charset=ISO-8859-1 I'll jump in and mention a solution to an at least similar problem I hacked, albeit incompletely, some time ago. I baldly stole code from "dired-mplayer" at http://www.emacswiki.org/cgi-bin/wiki/EMMS#toc10 , and have been using the result, "dired-vlc" ever since. The main point of this was to play videos asynchronously, so I could continue editing, taking notes using the relative timer of org-mode. Two more things would make this process work better, at least for me: 1. write a few lines into this that would open another buffer, possibly through capture, starting the relative timer automagically. 2. figure out how to pause the video and the timer simultaneously. Here is the code to dired-vlc. I am not interested in making this work for windows, have no idea whether it would, or how to make it do so. #+BEGIN_EXAMPLE ;; -*- mode: elisp -*- ;; Time-stamp: <2009-01-13 14:27:47 orm> ;; AED 05 January 2009 ;;;;;;;;;;;;;;;;; (require 'org) (defvar dired-vlc-program "/usr/bin/vlc") (defun dired-vlc (&optional timer) "Asynchronously start vlc on file through dired. If an optional argument is given (C-u), the org relative timer is started. This function purports to start vlc in rc mode, to leave open the possibility of remote control." (interactive "P") (let ((file (expand-file-name (dired-get-filename))) ext files basename dir curr-file ;idx-file sub-file srt-file command options) (setq basename (file-name-nondirectory (file-name-sans-extension file))) (setq dir (file-name-directory file)) (setq files (directory-files dir t basename)) (delete file files) (setq command (format "\"%s\" \"%s" dired-vlc-program "--intf rc")) (if (y-or-n-p (format "Run command %s?" command)) (start-process "junk" nil dired-vlc-program file))) (if (equal timer '(4)) (org-timer-start)) ) ;; end dired-vlc.el #+END_EXAMPLE I am interested in what you are doing, also, and I will try it out in a month or two, after I retire and relocate. Alan Davis On Sun, Jun 12, 2011 at 12:00 AM, Memnon Anon < gegendosenfleisch@googlemail.com> wrote: > Paul Sexton writes: > > > brian powell gmail.com> writes: > > > > > >> * Something like this; respectively!?: > >> > >> [[shell:mplayer -ss 00:03:21 -endpos 00:06:54 ~/some_podcast.mp3 &]] > >> [[shell:mplayer -ss 00:03:21 ~/some_podcast.mp3 &]] > >> [[shell:mplayer ~/some_podcast.mp3 &]] > > > > The troubles with using shell commands in hyperlinks: > > 1. Only works in the operating system and directory structure where > > you were when you wrote the link; > > 2. No ability to stop playback, pause, etc, unless you run the > > program as a GUI, which means (horror!) doing something outside > > Emacs. > > If you are using different setups on different operating systems, 1) > should probably be solved in some general fashion, like setting some > vars to important locations depending on environmentearly in your .emacs. > > 2.) > [[elisp:(emms-play-file "~/tmp/video/magit.flv")]] > or > [[elisp:(emms-play-file (concat MYSCREENCASTSDIR "magit.flv"))]] > or > [[elisp:(emms-play-file (concat MYSCREENCASTSDIR "magit.flv"))][View magit > demo]] > > Of course, there is no problem with setting up org to treat file links to > mediafiles special. But given the power of org hyperlinks, I think using > "elisp:" solves your 1.) and 2.) sufficiently. > > Memnon > > > --000e0cd6668ec799d304a5786d44 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I'll jump in and mention a solution to an at least similar problem I ha= cked, albeit incompletely, some time ago.=A0 I baldly stole code from "= ;dired-mplayer" at http://www.emacswiki.org/cgi-bin/wiki/EMMS#toc10 , and have b= een using the result, "dired-vlc" ever since.=A0=A0 The main poin= t of this was to play videos asynchronously, so I could continue editing, t= aking notes using the relative timer of org-mode.=A0=A0

Two more things would make this process work better, at least for me:
=A0=A0 1. write a few lines into this that would open another buffer,= possibly through capture, starting the relative timer automagically.
= =A0=A0 2. figure out how to pause the video and the timer simultaneously.
Here is the code to dired-vlc.=A0 I am not interested in making this wo= rk for windows, have no idea whether it would, or how to make it do so.
=
#+BEGIN_EXAMPLE
;;=A0 -*- mode: elisp -*-
;; Time-stamp: <2009= -01-13 14:27:47 orm>
;; AED 05 January 2009
;;;;;;;;;;;;;;;;;

(require 'org)

(defvar dired-vlc-program "/usr/bin/vlc")


(defun= dired-vlc (&optional timer)
=A0 "Asynchronously start vlc on f= ile through dired.=A0 If an optional
argument is given (C-u), the org relative timer is started.=A0 This
fun= ction purports to start vlc in rc mode, to leave open the
possibility o= f remote control."
=A0 (interactive "P")
=A0 (let ((fi= le (expand-file-name (dired-get-filename)))
=A0=A0=A0=A0=A0=A0=A0 ext files basename dir curr-file ;idx-file sub-file s= rt-file
=A0=A0=A0 command options)
=A0=A0=A0 (setq basename (file-nam= e-nondirectory
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 (file-name-sans-extension f= ile)))
=A0=A0=A0 (setq dir (file-name-directory file))
=A0=A0=A0 (setq files (directory-files dir t basename))
=A0=A0=A0 (delet= e file files)
=A0=A0=A0 (setq command (format "\"%s\" \&q= uot;%s" dired-vlc-program "--intf rc"))
=A0=A0=A0 (if (y-= or-n-p (format "Run command %s?" command))
=A0=A0=A0=A0=A0=A0=A0 (start-process "junk" nil dired-vlc-program= file)))
=A0 (if (equal timer '(4)) (org-timer-start))
)

<= br>;; end dired-vlc.el
#+END_EXAMPLE

I am interested in what you = are doing, also, and I will try it out in a month or two, after I retire an= d relocate.

Alan Davis

On Sun, Jun 12, 2011 at 12= :00 AM, Memnon Anon <gegendosenfleisch@googlemail.com> wrote:
Paul Sexton <psexton@xnet.co.nz> writes:

> brian powell <briangpowellms <at>
gmail.com> writes:
>
>
>> * Something like this; respectively!?:=A0
>>
>> [[shell:mplayer -ss 00:03:21=A0-endpos=A000:06:54 ~/some_podcast.m= p3 &]]
>> [[shell:mplayer -ss 00:03:21 ~/some_podcast.mp3 &]]
>> [[shell:mplayer ~/some_podcast.mp3 &]]
>
> The troubles with using shell commands in hyperlinks:
> 1. Only works in the operating system and directory structure where > =A0 =A0you were when you wrote the link;
> 2. No ability to stop playback, pause, etc, unless you run the
> =A0 =A0program as a GUI, which means (horror!) doing something outside=
> =A0 =A0Emacs.

If you are using different setups on different operating systems, 1)<= br> should probably be solved in some general fashion, like setting some
vars to important locations depending on environmentearly in your .emacs.
2.)
=A0 =A0[[elisp:(emms-play-file "~/tmp/video/magit.flv")]]
or
=A0 =A0[[elisp:(emms-play-file (concat MYSCREENCASTSDIR "magit.flv&qu= ot;))]]
or
[[elisp:(emms-play-file (concat MYSCREENCASTSDIR "magit.flv"))][V= iew magit demo]]

Of course, there is no problem with setting up org to treat file links to mediafiles special. But given the power of org hyperlinks, I think using "elisp:" solves your 1.) and 2.) sufficiently.

Memnon



--000e0cd6668ec799d304a5786d44--