soundklaus

https://github.com/r0man/soundklaus.el.git

git clone 'git://github.com/r0man/soundklaus.el.git'
12

soundklaus.el Build Status

Play SoundCloud music in Emacs via EMMS.

Prerequisites

This mode requires Emacs 24. Other required dependencies are curl to stream tracks, mp3info to tag them, and a music player that is supported by EMMS. Music Player Daemon is known to work out of the box, VLC Media Player after some tweaking.

Installation

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]

Configuration

This mode requires a working EMMS setup for Emacs. The following code from the EMMS Quick-Start Guide should work with some minor tweaks.

(require 'emms-setup)
(emms-standard)
(emms-default-players)

Music Player Daemon

If you are using the Music Player Daemon everything should work out of the box after adding the player to the list of EMMS players.

(require 'emms-player-mpd)
(add-to-list 'emms-player-list 'emms-player-mpd)

VLC Media Player

The default configuration of the VLC Media Player that ships with EMMS doesn't support HTTPS. This can be fixed by changing the regular expression of the player.

(require 'emms-player-vlc)
(define-emms-simple-player vlc '(file url)
  (concat "\\`\\(https?\\|mms\\)://\\|"
      (emms-player-simple-regexp
       "ogg" "mp3" "wav" "mpg" "mpeg" "wmv" "wma"
       "mov" "avi" "divx" "ogm" "ogv" "asf" "mkv"
       "rm" "rmvb" "mp4" "flac" "vob" "m4a" "ape"))
  "vlc" "--intf=rc")

MPlayer

MPlayer can't follow redirect links when playing streams. This is currently required by soundklaus.el, so MPlayer is not supported at the moment.

Usage

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. 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.

Authentication

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;

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.

In detail what should be done is this:

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. You should save and load this variable from a safe place for future sessions.

Screenshot

License

Copyright © 2014 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.