Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
andersjohansson opened this issue Sep 27, 2016 · 4 comments
Open

Comments

@andersjohansson
Copy link
Contributor

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:

  • Session saving and resuming, either in file-local variables or in org-mode properties
  • Modeline display of play/pause status and current position in file (rightmost in screenshot below). This has been buggy from time to time but I believe my last changes to this feature made it non-interruptive.
    modeline
  • Timestamps written to org-mode links. Apart from looking quite nice by default, this has the added benefit that clicking on a timestamp takes you directly to the right position in the right file.

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
Copy link
Contributor Author

andersjohansson commented Sep 27, 2016

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
Copy link
Contributor

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
#10 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACsltcOBICXB5IkMRO4bXn8YGA4QLO4ks5quSZlgaJpZM4KHuJ7
.

@markhepburn
Copy link
Owner

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
Copy link
Contributor Author

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:

  • all kinds of controls (skipping, speed, starting, stopping...)
  • Display of status (modeline)
  • Saving sessions? (I save filename, position, playback-speed in file local variables or org-mode headline properties to be able to continue where I left off, but at least the org-mode part should probably be an extension in current thinking)
  • More?

Extensions:

  • Can access data from mplayer-mode to write out timestamps, links (the "get-"-functions I implemented are helpful for this)
  • What more could be of interest?

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants