emms-player-simple-mpv.el is an extension of emms-player-simple.el for mpv JSON IPC. It provides basic functions for interface defined in EMMS ( The Emacs Multimedia System ).
emms-player-simple-mpv-control-functions.el provides other functions to control mpv.
The following example configuration files are available:
- emms-player-simple-mpv-e.g.time-display.el
- emms-player-simple-mpv-e.g.playlist-fname.el
- emms-player-simple-mpv-e.g.hydra.el
- emms-player-simple-mpv
- Requirements
- Setup
- Usage
- Customization
- Macro:
define-emms-simple-player-mpv
name types regex command &rest args - Function:
emms-player-simple-mpv-add-to-converters
player regexp types fn &optional appendp - User Option:
emms-player-simple-mpv-use-volume-change-function-p
- Minor Mode:
emms-player-simple-mpv-keep-volume-mode
- Minor Mode:
emms-player-simple-mpv-keep-speed-mode
- User Option:
emms-player-simple-mpv-keep-properties
- User Option:
emms-player-simple-mpv-ipc-dir
- User Option:
emms-player-simple-mpv-tq-event-pause-hook
- User Option:
emms-player-simple-mpv-tq-event-unpause-hook
- User Option:
emms-player-simple-mpv-tq-event-playback-restart-hook
- User Option:
emms-player-simple-mpv-tq-event-property-change-functions-alist
- User Option:
emms-player-simple-mpv-tq-event-filename-functions
- User Option:
emms-player-simple-mpv-tq-event-volume-functions
- User Option:
emms-player-simple-mpv-tq-event-speed-functions
- User Option:
emms-player-simple-mpv-tq-event-duration-functions
- Macro:
- Example configuration files
- emms-player-simple-mpv-playlist-mode
- References
- GNU Emacs 24 or later
- EMMS 4.0 or later
- mpv v0.10.0 or later ( https://github.com/mpv-player/mpv )
- Unix Sockets
Tested on GNU Emacs 25.3.1 (emacs-mac-app 6.7_0), EMMS 4.3, mpv v0.26.0.
(add-to-list 'load-path "/path/to/emms-player-simple-mpv")
(require 'emms-player-simple-mpv)
;; This plugin provides control functions (e.g. ab-loop, speed, fullscreen).
(require 'emms-player-simple-mpv-control-functions)
;; An example of setting like emms-player-mplayer.el
;; `emms-player-my-mpv' is defined in this case.
(define-emms-simple-player-mpv my-mpv '(file url streamlist playlist)
(concat "\\`\\(http[s]?\\|mms\\)://\\|"
(apply #'emms-player-simple-regexp
"aac" "pls" "m3u"
emms-player-base-format-list))
"mpv" "--no-terminal" "--force-window=no" "--audio-display=no")
(emms-player-simple-mpv-add-to-converters
'emms-player-my-mpv "." '(playlist)
(lambda (track-name) (format "--playlist=%s" track-name)))
(add-to-list 'emms-player-list 'emms-player-my-mpv)
(dolist (map (list emms-playlist-mode-map
emms-stream-mode-map))
(define-key map (kbd "m") 'emms-player-simple-mpv-mute)
(define-key map (kbd "[") 'emms-player-simple-mpv-speed-decrease)
(define-key map (kbd "]") 'emms-player-simple-mpv-speed-increase)
(define-key map (kbd "{") 'emms-player-simple-mpv-speed-halve)
(define-key map (kbd "}") 'emms-player-simple-mpv-speed-double)
(define-key map (kbd "<backspace>") 'emms-player-simple-mpv-speed-normal)
(define-key map (kbd "T") 'emms-player-simple-mpv-ontop)
(define-key map (kbd "F") 'emms-player-simple-mpv-fullscreen)
(define-key map (kbd "9") 'emms-volume-lower)
(define-key map (kbd "0") 'emms-volume-raise))
(let ((map emms-playlist-mode-map))
(define-key map (kbd ",") 'emms-player-simple-mpv-playlist-prev)
(define-key map (kbd ".") 'emms-player-simple-mpv-playlist-next))
;; Playing YouTube playlist in reverse order.
;; `emms-player-my-mpv-ytpl-reverse' will be defined in this case.
(define-emms-simple-player-mpv my-mpv-ytpl-reverse '(url)
"\\`http[s]://www\\.youtube\\.com/playlist\\?list="
"mpv" "--no-terminal" "--force-window=no" "--audio-display=no"
"--ytdl" "--ytdl-raw-options=playlist-reverse=")
(add-to-list 'emms-player-list 'emms-player-my-mpv-ytpl-reverse)
M-x emms-player-simple-mpv-playlist-popup
can display playlist
This macro emulates define-emms-simple-player
. See EMMS Manual 11 Simple Players.
This function adds a list (regexp types fn) to player’s mpv-track-name-converters
.
fn converts track name to input form
when mpv needs specific format such as ffplay format for playing some protocols.
Default value is t
.
If the variable is non-nil,
emms-player-simple-mpv-volume-change
is used as emms-volume-change-function
while an emms simple player of mpv is running.
If it is non-nil, the last volume value is used when new track starts.
(emms-player-simple-mpv-keep-volume-mode 1)
provides it.
M-x emms-player-simple-mpv-keep-volume-mode
toggles it.
If it is non-nil, the last speed value is used when new track starts. Only track type of file is available.
(emms-player-simple-mpv-keep-speed-mode 1)
provides it.
M-x emms-player-simple-mpv-keep-speed-mode
toggles it.
Alist of property name, function and symbol which has the last value. The function which checks the last value is available takes no arguments and returns boolean.
The directory name for IPC. If nil, temporary-file-directory
will be used.
Default value is nil
.
Normal hook run when TQ process receives “pause” from mpv.
Normal hook run when TQ process receives “unpause” from mpv.
Normal hook run when TQ process receives “playback-restart” from mpv.
Alist of property name and abnormal hook. When TQ process receives “property-change”, an abnormal hook is run.
Abnormal hook run with one argument which is filename.
emms-player-simple-mpv-tq-event-property-change-functions-alist
includes it.
Abnormal hook run with one argument which is volume.
emms-player-simple-mpv-tq-event-property-change-functions-alist
includes it.
Abnormal hook run with one argument which is speed.
emms-player-simple-mpv-tq-event-property-change-functions-alist
includes it.
Abnormal hook run with one argument which is duration.
This file is an example configuration for emms-playing-time-display
to synchronize with time-pos
of mpv.
(requre 'emms-player-simple-mpv-e.g.time-display)
provides it.
This file is an example configuration for displaying filename
of mpv for each track
when a playlist file is used.
(requre 'emms-player-simple-mpv-e.g.playlist-fname)
provides it.
This file is an example configuration for hydra ( https://github.com/abo-abo/hydra ). It emulates default key bindings of mpv player.
(requre 'emms-player-simple-mpv-e.g.hydra)
provides it.
;; This variable can be set before loading.
(setq emms-player-simple-mpv-hydra-docstring "mpv hydra\n")
(require 'emms-player-simple-mpv-e.g.hydra)
Major mode for displaying mpv playlist.
(require 'emms-player-simple-mpv-playlist-mode)
;; Some mpv control functions can be added to `emms-player-simple-mpv-playlist-mode-map'.
(emms-player-simple-mpv-playlist-mode-setup-keybinds)
M-x emms-player-simple-mpv-playlist-popup
Some commands are defined:
- Variable:
emms-player-simple-mpv-playlist-mode-map
- Function:
emms-player-simple-mpv-playlist-mode-setup-keybinds
This will be used for the action arg of display-buffer
in emms-player-simple-mpv-playlist-popup
.
Default value is
'((display-buffer-reuse-window
display-buffer-at-bottom
display-buffer-pop-up-window)
(window-height . 0.3))
This can be set to a function name which is used for formatting a entry. The function takes a entry and the position as arguments.
Default value is emms-player-simple-mpv-playlist-mode-default-format-function
.
Keymap for emms-player-simple-mpv-playlist-mode
the parent of which is special-mode
.
The following keys are added.
Key | Action |
---|---|
RET | Play the entry at point. |
d | Remove the entry at point. |
M-up | Move up the entry at point. |
M-down | Move down the entry at point. |
> | Call playlist-next. |
< | Call playlist-prev. |
r | Call playlist-shuffle. |
R | Call playlist-shuffle and set playlist-pos to 0. |
g | Reload the playlist. |
. | Refresh the playlist (point will move to the current entry.) |
c | Go to the current entry point. |
The following keys will be added to emms-player-simple-mpv-playlist-mode-map
.
Key | Action |
---|---|
m | Toggle mute. |
p | Toggle pause. |
<left>/ | Seek -5 sec. |
<right> | Seek +5 sec. |
S-<left> | Seek -1 sec. |
S-<right> | Seek +1 sec. |
[ | Decrease speed. |
] | Increase speed. |
{ | Halve speed. |
} | Double speed. |
<backspace> | Reset speed to normal. |
T | Toggle ontop. |
f | Toggle fullscreen |
9 | Decrease volume |
0 | Increase volume |
l | Call ab-loop. |
- emms-player-mpv ( https://github.com/dochang/emms-player-mpv )
- mpv.el ( https://github.com/kljohann/mpv.el )
- mpv reference manual ( https://mpv.io/manual/ )