~protesilaos/mandoura

2c3224b208e6c3557bfa9b9c89ca7f9bc809308b — Protesilaos Stavrou 1 year, 25 days ago 95ad8f1
Define mandoura-play-file-with-optional-subs
1 files changed, 20 insertions(+), 0 deletions(-)

M mandoura.el
M mandoura.el => mandoura.el +20 -0
@@ 189,6 189,26 @@ the user to replay it.  Else create a new temporary file."
  (mandoura--make-process playlist)
  (setq mandoura-last-playlist playlist))

;;;###autoload
(defun mandoura-play-file-with-optional-subs (file &optional subtitles)
  "Prompt for FILE to play, with optional SUBTITLES file.

Prompt for SUBTITLES, which is a file that contains subtitles
pertinent to FILE.

When called from Lisp FILE and SUBTITLES are file paths,
represented as strings."
  (interactive
   (list
    (read-file-name "Select media file: ")
    (read-file-name "Select subtitles file: ")))
  (unless (executable-find "mpv")
    (error "Cannot find mpv executable; aborting"))
  (mandoura--kill-running-process)
  (mandoura--make-process
   file
   (when subtitles `(,(format "--sub-file=%s" subtitles)))))

;;;; Communicate with the socket (--input-ipc-server)

;; See <https://mpv.io/manual/master/#properties>.