markhepburn / mplayer-mode

Control mplayer from Emacs; mainly intended for use in transcription and note-taking.
23 stars 11 forks source link

Possible new features: What should be included in mplayer-mode? #10

Open andersjohansson opened 8 years ago

andersjohansson commented 8 years ago

I saw that @KarlHegbloom has started to implement a few new features, some of which have been merged here. I was wondering if we perhaps were duplicating some efforts, because I have also done some quite extensive rewrites of mplayer-mode which might benefit others. I'm still not really sure about which of them might be reasonable to include in mplayer-mode and which should be viewed as making it too complicated, as mplayer-mode maybe should be a somewhat small and simple package.

So this issue is to open a little discussion about it.

The use case for which I implemented this was transcribing research interviews, and writing it in structured org-mode-files.

My somewhat messy development history can be found in this branch: https://github.com/andersjohansson/mplayer-mode/tree/org-sessions

The main features I implement are:

So, @markhepburn, do you think that any of this would be good to integrate in mplayer-mode (and do you have time and energy to think about this at all, I don't expect anything from you, really)? It's a tighter integration with org-mode, which could be helpful for some, but perhaps should be optional. Some of the features could probably be provided in an auxiliary package, I haven't thought that through.

Well, thanks for all your efforts so far, mplayer-mode has helped me a lot.

andersjohansson commented 8 years ago

As I said. Messy. I just realized that the org-link timestamp stuff was implemented in a separate file with some code for this, so that doesn't really change anything in mplayer-mode at all except that it depends on some of my new functions mplayer--get-time and mplayer--get-filename. Here is the code for that:

(defun orgqda/mplayer-insert-timestamp-link ()
  "Insert a timestamp link which can be followed in `mplayer-mode'."
  (interactive)
  (let ((time (mplayer--get-time))
        (file (mplayer--get-filename)))
    (when time
      (insert (format "[[oqdats:%s:%s][%s]] "
                      time file
                      (mplayer--format-time time "%H:%M:%S"))))))

(org-add-link-type "oqdats" #'orgqda/follow-timestamp-link #'orgqda/export-timestamp-link)

(defun orgqda/follow-timestamp-link (filetime)
  "Follow `oqdats' timestamps with `mplayer-seek-position'."
  (let* ((ft (split-string filetime ":"))
         (pos (car ft))
         (file (cadr ft))
         (mp (process-live-p mplayer--process)))
    (if file
        (if mp
            (unless (string= file (mplayer--get-filename))
              (mplayer-quit-mplayer)
              (sleep-for 0.1)
              (mplayer-find-file file))
          (mplayer-find-file file))
      (unless mp
        (error "No file in link and no mplayer--process"))) 
    (mplayer-seek-position (string-to-number pos) t)))

(defun orgqda/export-timestamp-link (path desc format)
  "Export `oqdats' timestamps."
  (if (eq format 'latex)
      (format "\\ajts[%s]{%s}" path desc)
    (format "[%s]" desc)))
KarlHegbloom commented 8 years ago

I've done some further work that's not integrated yet but slated for it. I'm on my tablet (eating lunch right at the moment) but I'll pin this and follow up later from my laptop.

I focused on asciidoc markup so I can typeset transcripts. I want to extend it to make it also provide a media player and icon links to jump playback to there, in the html output. Only links in pdf unless anyone provides the code to asciidoctor-pdf to embed a media player and javascript to control it.

I'm not familiar with org-mode. I keep coming across references to it. I need to spend some time learning about it. What about hyperbole?

On Tue, Sep 27, 2016, 08:57 Anders Johansson notifications@github.com wrote:

As I said. Messy. I just realized that the org-link timestamp stuff was implemented in a separate package I've made for this, so that doesn't really change anything in mplayer-mode at all except that it depends on some of my new functions mplayer--get-time and mplayer--get-filename. Here is the code for that:

(defun orgqda/mplayer-insert-timestamp-link () "Insert a timestamp link which can be followed in `mplayer-mode'." (interactive) (let ((time (mplayer--get-time)) (file (mplayer--get-filename))) (when time (insert (format "[[oqdats:%s:%s][%s]] " time file (mplayer--format-time time "%H:%M:%S"))))))

(org-add-link-type "oqdats" #'orgqda/follow-timestamp-link #'orgqda/export-timestamp-link)

(defun orgqda/follow-timestamp-link (filetime) "Follow oqdats' timestamps withmplayer-seek-position'." (let* ((ft (split-string filetime ":")) (pos (car ft)) (file (cadr ft)) (mp (process-live-p mplayer--process))) (if file (if mp (unless (string= file (mplayer--get-filename)) (mplayer-quit-mplayer) (sleep-for 0.1) (mplayer-find-file file)) (mplayer-find-file file)) (unless mp (error "No file in link and no mplayer--process"))) (mplayer-seek-position (string-to-number pos) t)))

(defun orgqda/export-timestamp-link (path desc format) "Export `oqdats' timestamps." (if (eq format 'latex) (format "\ajts[%s]{%s}" path desc) (format "[%s]" desc)))

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/markhepburn/mplayer-mode/issues/10#issuecomment-249879545, or mute the thread https://github.com/notifications/unsubscribe-auth/AACsltcOBICXB5IkMRO4bXn8YGA4QLO4ks5quSZlgaJpZM4KHuJ7 .

markhepburn commented 8 years ago

Hi guys -- thanks @andersjohansson , @KarlHegbloom . I haven't used this project myself for quite some time and I'm thrilled that it has been useful for other people as well, and thanks for your contributions as well. It has been at the back of my mind to take a fresh look at it, but who knows when I'd have gotten around to doing anything substantial. Given that you guys use it a lot more, I'm not averse to turning it over, or making a small organisation if that's not overkill.

In terms of my own thoughts, org-mode integration was probably the main thing I would have added I suspect -- in particular, automatically inserting timestamps for every new heading.

I do have a preference for keeping the core functionality separate, and either adding extension points if necessary or just using it as a library to add extra functionality into other modes. I like the idea of displaying status in the modeline and that's probably a core addition; org-mode integration is more of an extension, to my way of thinking.

What do you guys think?

andersjohansson commented 8 years ago

Cool, yeah, maybe trying to keep a kind of core library with some extension points is a reasonable way forward, and integration with different markup formats etc. should be add-ons.

About org-mode vs hyperbole (which I in my turn had never heard of, there is so much in the Emacs universe): I believe that org-mode has (or can have) a good focus on creating structured documents, and I believe that is what most people using mplayer-mode are interested in: transcription into structured documents. Hyperbole seems to be much more about organising information in a more abstract fashion? Actually, org-mode is very good for writing (lots of people do) and I have written entire scientific papers in it (exported and processed through LaTeX)

Of course, there is always the issue about time and effort. I have mostly been hacking away in the mode "this feature would be cool and useful for me to have right now, let's implement it somewhere" and not given that many thoughts to separation and reusability. I would surely think it would be nice to be part of some effort to keep together a good library that we could build extensions for our use-cases on, but I don't think I can promise any concentrated development time at any time.

For now, a small draft: Core mplayer-mode: Aims at providing a good interface to control mplayer from emacs. This could include:

Extensions:

Finally, whatever we might make of it in the future, it's so good that we are able to combine these kinds of small efforts for small tools that we might find helpful in our own different contexts. Free software!