Skip to content

mpdel/mpdel

Repository files navigation

MPDel

MELPA Stable MELPA pipeline status

Summary

MPDel is an Emacs client for Music Player Daemon (MPD), a flexible, powerful, server-side application for playing music. MPDel provides an Emacs user interface to control playback (play, pause, next, volume up…) and to display and control the current playlist as well as your stored playlists (e.g., “my favorites”, “wake me up”, “make me dance”, …).

This is a screenshot of the MPDel music browser and the current playlist buffer with the currently-playing song:

media/mpdel-browser.png

MPDel can show information about the currently playing song or any other song:

media/mpdel-song.png

With the additional package ivy-mpdel or mpdel-embark you can navigate your music database and add songs to playlists with completion:

media/ivy-mpdel.png

Installing

Get mpdel from melpa or melpa stable. You also need to install libmpdel.

You need to install and (quickly) configure an MPD server if you don’t have any yet. Don’t worry, that’s simple and you won’t regret it.

Using

Start by adding these lines to your init.el file:

(add-to-list 'load-path "~/.emacs.d/lib/mpdel")
(require 'mpdel)
(mpdel-mode)

Then, press C-x Z l to show the current playlist. The C-x Z global prefix is configurable with mpdel-prefix-key:

(setq mpdel-prefix-key (kbd "C-. z"))

The following MPDel keybindings are available globally if mpdel-mode is active:

BindingAction
C-x Z SPCtoggle between play and pause
C-x Z M-nplay next song
C-x Z M-pplay previous song
C-x Z Prestart playing current song
C-x Z lopen the current playlist
C-x Z Lshow stored playlists
C-x Z Nnavigate your database from artists
C-x Z :navigate your database from the browser
C-x Z vview current song
C-x Z s rsearch songs by artist name
C-x Z s lsearch songs by album name
C-x Z s ssearch songs by song title
C-x Z fgo forward current song by mpdel-song-normal-increment
C-x Z Fgo forward current song by mpdel-song-small-increment
C-x Z M-fgo forward current song by mpdel-song-large-increment
C-x Z bgo backward current song by mpdel-song-normal-decrement
C-x Z Bgo backward current song by mpdel-song-small-decrement
C-x Z M-bgo backward current song by mpdel-song-large-decrement

The last component of each keybinding can also be pressed in any MPDel buffer (e.g., press M-n in a playlist buffer to play the next song) to do the same. Additionally, the following keybindings are available in all MPDel buffers where they make sense:

BindingAction
aadd item to current playlist
Aadd item to a stored playlist
rreplace current playlist with item
Rreplace a stored playlist with item
Pplay selected items immediately
vview currently played song
RETopen a buffer showing item at point
^open item’s parent
C-x C-jopen a dired buffer on item at point
nmove to next line
pmove to previous line
+increase playback volume
-decrease playback volume
Cconnect to a different profile

Opening a dired buffer on the item at point requires configuring libmpdel-music-directory first.

Navigator

The keybinding C-x Z N (or just N in any MPDel buffer) opens a navigator on your database. You first get a list of all artists. From there, you can press a, A, r or R (see above) to add the item at point to a playlist. You can also press RET (the enter key) to “dive” into the selected item and display a list of the artist’s albums. On the contrary, press ^ to go back to the item’s parent (e.g., artist of the album at point). Keybindings are also available here to add albums to a playlist or dive into an album’s songs. Diving into a song displays some information about it.

Playlists

Playlist buffers display either the current playlist (C-x Z l or just l) or any stored playlist (C-x Z L or just L). A playlist buffer lists songs and can be edited.

Here is a list of keybindings available for the current playlist buffer:

BindingAction
C-x C-ssave current playlist in a new one
mmark the song at point
kremove marked song(s) from the playlist
M-upmove marked song(s) up in the playlist
M-downmove marked song(s) down in the playlist

When a command acts on the marked song(s) (such as k), the song at point is used if there is no marked song.

Playlist buffers are refreshed automatically when the MPD server refreshes them.

Browser

The MPDel Browser offers an overview of MPDel entry points (see above for a screenshot). To access the browser’s top-level buffer, press C-x Z : (or call the interactive command mpdel-browser-open). By default, the top level buffer gives you access to your music directory, as well as the artist and albums navigators, playlists and available searches. Pressing RET on any line will open the corresponding item. In particular, Music directory will let you to navigate across directories: beyond local directories, some MPD servers, such as Mopidi, map remote services to virtual directories.

Regular MPDel keybindings work in the browser too.

Song

Song buffers display information about a song, either the currently played one (C-x Z v or just v) or the song at point (with V). When displaying the currently played song, the buffer also shows playback status (e.g., “Currently playing”) and current playback position in song (e.g., “02:32 / 06:01”). Press ^ to open a navigator on the song’s album.

Customizing

By default, MPDel just works and you don’t have to customize anything. Nevertheless, there are a few customization options if you are that kind of person (and you probably are 😄).

Browser

It is possible to customize the layout of the browser’s top-level buffer via the variable mpdel-browser-top-level-entries, and to filter or rearrange how children buffers show their contents with mpdel-browser-list-clean-up-function. Please see the customization group mpdel-browser for more details.

Communication with MPD

If you have only one MPD server, you can tell libmpdel how to communicate with it through the options libmpdel-hostname and libmpdel-port. If you have more than one server, configure them in libmpdel-profiles. In this case, change the active server profile with M-x libmpdel-connect-profile.

Keyboard

As discussed above, you might want to configure mpdel-prefix-key to control which global keybinding gives you access to MPDel. This prefix key is active when mpdel-mode is active.

There are several keybinding tables (i.e., keymaps) to modify to your taste:

Keymap variableDescription
mpdel-core-mapactive globally
mpdel-nav-mode-mapactive in navigators
mpdel-playlist-mode-mapactive in current and stored playlists
mpdel-song-mode-mapactive in song buffers

Faces

MPDel defines several faces to customize the playlists:

Face nameDescription
mpdel-playlist-current-song-facecurrently-played song
mpdel-tablist-song-name-facesong names
mpdel-tablist-track-facetrack numbers
mpdel-tablist-album-facealbum names
mpdel-tablist-disk-facedisk numbers
mpdel-tablist-date-facedates
mpdel-tablist-artist-faceartist names

Hooks

You can add functions to the hooks below to get your code executed on a particular occasion:

Hook nameOccasion
libmpdel-current-playlist-changed-hookwhen the current playlist is modified
libmpdel-stored-playlist-changed-hookwhen a stored playlist is modified
libmpdel-player-changed-hookwhen the player status changes (start, stop, seek)
libmpdel-current-song-changed-hookwhen the current song changes

Extras

If your music files are hosted on the computer where MPDel is running, you can configure libmpdel-music-directory to navigate to a music file with C-x C-j from any MPDel buffer.

Filter Expressions

The command mpdel-core-search-by-filter can be used to search for songs using a MPD filter expression.

This requires a MPD version >= 0.21.

License

See COPYING. Copyright (c) 2018-2023 Damien Cassou.

Donate using Liberapay