Play music on SoundCloud with Emacs via EMMS.
This mode requires Emacs 24, curl to stream tracks, mp3info to tag them, and a music player that is supported by EMMS. Music Player Daemon, MPlayer and VLC Media Player are known to work with soundklaus.el.
soundklaus.el is available on MELPA. Instructions on how to configure MELPA can be found here. After configuring MELPA you can install soundklaus.el with the following command:
M-x package-install [RET] soundklaus [RET]
If you are using use-package to manage your Emacs packages, you can install and autoload soundklaus.el with the following code:
(use-package soundklaus
:ensure t
:commands
(soundklaus-activities
soundklaus-connect
soundklaus-my-favorites
soundklaus-my-playlists
soundklaus-my-tracks
soundklaus-playlists
soundklaus-tracks))
This mode requires a working EMMS setup for Emacs. The following code from the EMMS Quick-Start Guide should get you started.
(require 'emms-setup)
(emms-standard)
(emms-default-players)
You can search songs with M-x soundklaus-tracks
and playlists
with M-x soundklaus-playlists
. Your own tracks and playlists are
available with M-x soundklaus-my-tracks
and M-x
soundklaus-my-playlists
. You can list your favorite tracks with
soundklaus-my-favorites
. In the *soundklaus*
buffer you can move
to the next song with C-n
or n
, and to the previous one with
C-p
or p
. Pressing RET
plays the current song, and a
adds
the current song at point to the EMMS playlist. All other
available key bindings can be seen with M-x describe-minor-mode
[RET] soundklaus-mode
.
Some commands like M-x soundklaus-activities
or M-x
soundklaus-my-tracks
need access to your SoundCloud account. Your
web browser should open Emacs via emacsclient
for the OAuth2
callback URL soundklaus://oauth/callback
.
On a Linux system you can configure this by running M-x
soundklaus-desktop-entry-save
. This will write the following
content to the ~/.local/share/applications/soundklaus.desktop
file in your home directory.
[Desktop Entry] Name=SoundKlaus Exec=emacsclient %u Icon=emacs-icon Type=Application Terminal=false MimeType=x-scheme-handler/soundklaus;
Next, make sure your Emacs runs as a server. You can do this by adding this to your Emacs configuration.
(unless (server-running-p)
(add-hook 'after-init-hook 'server-start t)))
Now you can start the OAuth2 authentication dance with M-x
soundklaus-connect
. You should get redirected to SoundCloud and
allow soundklaus.el to access your account. After pressing the
Connect
button on the SoundCloud page, the browser should open
Emacs and set the soundklaus-access-token
customization variable.
To setup this functionality on other operating systems take a look at the system setup section in org-protocol.el and adapt it for soundklaus.el.
Copyright © 2014-2019 r0man
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.