summaryrefslogblamecommitdiffstats
path: root/2019/talks/28.md
blob: 742c57928ab7a2dde5e5370b7117f0dcb6eddba2 (plain) (tree)


















































































































                                                                                                                                                      
[[!meta title="Play and control your music with Emacs - Damien Cassou"]]
[[!meta copyright="Copyright © 2019 Damien Cassou"]]

[[!template  id=vid
src="https://mirror.csclub.uwaterloo.ca/emacsconf/2019/emacsconf-2019-28-play-and-control-your-music-with-emacs--mpdel--DamienCassou.ogv"
type="video/ogg"]]

### Download

- [Video](https://mirror.csclub.uwaterloo.ca/emacsconf/2019/emacsconf-2019-28-play-and-control-your-music-with-emacs--mpdel--DamienCassou.ogv) (1080p)

### Transcript

- Hi everyone.  In this lightening talk, I would like to present
  MPDel, which is a user interface for MPD, the Music Player Daemon,
  that's implemented in Emacs Lisp and runs entirely within Emacs.  So
  it relies on Music Player Daemon, which is quite old because it's a
  sixteen years old project serving music with many different clients.
  So if I look at clients of MPD you see there are all different kinds
  so this ?android? projects or web projects or GTK projects and a
  curses project, web projects, so yeah many different kinds of
  clients.  MPDel is implemented in Emacs Lisp, it's divided into
  three parts.  So there is a library libmpdel, which is it's own
  project.  That's doesn't propose any user interface, but instead it
  proposes a set of primitive functions to build user interfaces on
  top.  Then you have the screenshot here on top of the MPDel, so it's
  mostly tabulated lists based, and then you have another UI which is
  based on ?IV?, and I will present ?the? two user interfaces in this
  context of this project.  So let's start the video by navigating the
  music database.  So it's a simple job to get the list of all your
  artists.  You can navigate with ?turned-out? shortcuts.  And you
  have isearch obviously ?for? imenu, and so I can go to ?pink? sites
  with quick shortcuts.  When you select your artists you can go to
  which album by pressing return, and to go from an album to a
  particular artist's songs, you also press return.

- So that is going ?deep? from the album to the artist and from the
  artist to the songs, and with carrots or shift-6 on my keyboard you
  go up to the parent from the song to the albums, and from the albums
  to the artists.  So the next thing we can see is the playlists, so
  on the left you have the database, and on the right I will put the
  playlist.  So for now there is nothing to listen to, and I will add
  things in these lists, so we can add either artists, albums or
  individual songs, so let's add one of my favorite songs, ?So equals?
  from Pink Floyd.  So you can add it to the playlist, or add it
  immediately stop playing it, so this time I want to immediately play
  it, so I press P for play.

- And then I will press the carrot to go back to the artists and add
  some more music, I will add an album by Dire Straits.  So if I press
  P now it will add all the album and also start with the first song,
  but because I don't want to interrupt ?ecos? I will just press a to
  add all the songs from this album.  What we want to do now is
  manipulate the playlists, so for now ?ecos? has started playing and
  I can modify the playlist to decide what will be next, so by default
  it's Sultans of Swing, but I can change that for prioritization for
  example.

- Like that, so I can move one song, I can also mark multiple songs
  and move them around.

- It's also possible to play the next song and the previous song so
  you have M-n to play the next. And M-p to play the previous one.  If
  you wanted to delete a few songs from your album you can select them
  and then press k for deletion, and then they are removed from the
  database, not from the database, but only from the playlists.  With
  t you can toggle the mark, so if I want to select everything by
  ?except ...? I can just press t.  And t again to ??, if I want to
  select everything I can always press t when nothing is marked, so I
  can erase everything at once.

- Something I can do now is display some information about the
  currently played song, so I can press v wherever I am to get the
  list of songs.  It's very important to notice that whatever view you
  are in the shortcuts are always the same, so if I go back to the
  navigator with n, I can press ?? information about the current song,
  so v here, which ?? about the current song.  So you see that there
  is the time, and the album and artist and ?? status, so if I pause
  the music, it ?? pause.  And backplaying.  I can move forward and
  move backward with M-s and M-v, I can do that slowly or fast with
  different shortcuts, and from the current song you can press carrots
  to go to the parents, so it's exactly the same shortcut as how we
  were navigating from the songs to the albums and from the albums to
  the artists, so it's carrots, and you go from the song to its album
  and then from the album to the artist.

- I tried when designing the shortcuts to make the keybindings do
  always the same thing wherever you are, so if I press M-f now I will
  fast-forward the current song, so the same shortcuts work the same
  everywhere.  And if I press ?....? Another way to control the
  current playlists or stop playlists is to use the Ivy based
  interface so it doesn't pop up any buffer, but you can still
  navigate your database and select the songs to play.  So if I start
  the interface I get the list of all my artists in the minibuffer, so
  I can choose for example MCC artists and the ?? ?king? and the song
  I will pick this one for example, and there are many things I can do
  from here, so I can add to the current playlist I can start playing
  immediately, I can start and stop playlists, so let's see I just p
  for playing it immediately.

- So MPDel is mostly based on tabulated lists, which I really liked.
  And after I implemented MPDel, I liked that kind of view so much I
  decided to use the views for other kinds of packages, so I
  implemented a database navigator, and also a network manager client
  using tabulated lists, and I realized that all of those libraries
  and tools they were sharing the same kind of code.  So I decided to
  abstract away from all of those and I created navigel which makes it
  very easy to implement tabulated lists if you have a model of your
  domain data that you want to navigate.

- There is a lightening talk at EmacsConf about navigel so I encourage
  you to have a look at it if you're interested in how I reimplemented
  MPDel so that it's much simpler, and how I implemented all the other
  packages.  This is the end of my talk, I hope you liked it.  And
  happy EmacsConf.