Python based sound-cloud music server talking MPD protocol.
NOTE: only basic MPD server daemon available yet
Main features currently supported:
- Browse predefined set of favorite users (see "~/.pyscmpd/pyscmpd.conf")
- Add tracks to current play-list
- Play tracks from play-list
- Change song order in current play-list
- Remove songs from play-list
- Clear whole play-list
- Start/stop/pause/resume songs
- Control volume
- Elapsed song time and current song-time are transmitted to clients
For a complete list of supported MPD commands see the implementation docs
Project Directory Layout
test-srcSome test/example sources
srcMain sources four pyscmpd
extlibExternal libraries (like python-mpd-server)
pyscmpdctrlTest-script to run "pyscmpd" from within the project directory
setup.pyPython setup script for installing "pyscmpd"
MANIFEST.inMeta-data for "setup.py"
- git for cloning the sources
- Python (2.6 or 2.7, not tested with 3)
- python-setuptools for installing soundcloud-python
- python soundcloud API
For more detailed install instructions see next chapter.
Quick Install Instructions
The following instructions describe in short, how to install "pyscmpd" on a raspberry pi with freshly installed raspian. For more detailed setup instructions see the next chapter.
Note: perform the following steps as user "pi".
1) Install missing debian packages
sudo apt-get install git python-setuptools python-gst0.10 gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-bad gstreamer0.10-plugins-ugly gstreamer0.10-alsa jackd ncmpcpp
2) Install soundcloud python API
sudo easy_install soundcloud
3) Install pysmpd
mkdir $HOME/src cd $HOME/src git clone https://github.com/wendlers/pyscmpd.git cd pyscmpd sudo python setup.py install
4) Autostart pyscmpd with the desktop
mkdir $HOME/.config/autostart cp ./etc/pyscmpd.desktop $HOME/.config/autostart/.
5) Run daemon, connect to it
pyscmpdctrl start ncmpcpp -p 9900
Detailed Install Instructions
On Debian Based Linux Systems (e.g. Ubuntu, Respian, ...)
For the following steps, it is assumed, that
$HOME/srcis your working directory:
1) Install soundcloud-python
apt-get python setuptools:
sudo apt-get install python-setuptools
clone the sources:
cd $HOME/src git clone https://github.com/soundcloud/soundcloud-python.git
run the setup script
cd soundcloud-python sudo python setup.py install
Note: Internet connection is needed for this step, since the installer will go and fetch some dependencies from the net.
2) Install python-gst and dependencies
apt-get the library:
sudo apt-get install python-gst0.10
on a fresh Respian, I needed additionally the following:
sudo apt-get install gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-bad gstreamer0.10-plugins-ugly gstreamer0.10-alsa jackd
3) Install pyscmpd
clone pyscmpd sources:
cd $HOME/src git clone https://github.com/wendlers/pyscmpd.git
cd pyscmpd sudo python setup.py install
3.1) Optional: autostart daemon with LXDE
If you like to start "pyscmpd" with your LXDE desktop on a raspberry pi, you could create the file "pyscmpd.desktop" under "$HOME/.config/autostart" with the following:
[Desktop Entry] Name=pyscmpd Comment=Python based soundcloud player using the MPD protocol Exec=pyscmpdctrl restart Icon=sound_section Terminal=false Type=Application Categories=Audio
Next time your desktop is started, "pyscmpd" will also be started.
4) Get a decent MPD client
I prefer ncmpcpp:
sudo apt-get install ncmpcpp
Or for a GUI based client sonata:
sudo apt-get install sonata
On Other Linux Systems
To be done ...
In the main directory start "pyscmpd" daemon with:
A default configuration is created under "~/.pyscmpd/pyscmp.conf". To change the port (default 9900), logging, or favorite users to browse change this file.
By default, the log output of the daemon could be viewed by:
tail -f ~/.pyscmpd/pyscmpd.log
Now you should be able to connect to the daemons default port 9900, e. g. with ncmpcpp:
ncmpcpp -p 9900
To stop the daemon use:
In case "pyscmpdctrl" complains about the PID file already existing, and you are sure the daemon is not running yet, you could use the following command to cleanup the PID file:
For debugging, it may be useful to start the daemon in foreground. This could be done by:
pyscmpdctrl --foreground start
By doing so, log messages are printed to "stdout", while the log-file specified will be ignored.
To modify the list of your favorite users to browse, edit the "[favorites]" section in "~/.pyscmpd/pyscmp.conf". The format used for favorite users is:
category: user1, user2, ...
category is then shown in the browser as top-level folder containing all the users specified. userN is the user name of a soundcloud user as shown in the URL. E.g. "griz" for GRiZ.
Each time "~/.pyscmpd/pyscmp.conf" is modified, the daemon needs to be restarted by:
Note: an example configuration could be found in "./etc/pyscmpd.conf".