2013-05-15 16:07:47 +00:00
|
|
|
Supysonic
|
|
|
|
=========
|
|
|
|
|
|
|
|
Supysonic is a Python implementation of the [Subsonic](http://www.subsonic.org/) server API.
|
|
|
|
|
2013-06-14 17:36:14 +00:00
|
|
|
Current supported features are:
|
2013-10-14 16:36:45 +00:00
|
|
|
* browsing (by folders or tags)
|
|
|
|
* streaming of various audio file formats
|
2013-10-15 16:43:32 +00:00
|
|
|
* transcoding
|
2013-10-14 16:36:45 +00:00
|
|
|
* user or random playlists
|
2013-05-15 16:07:47 +00:00
|
|
|
* cover arts (`cover.jpg` files in the same folder as music files)
|
2013-06-14 17:36:14 +00:00
|
|
|
* starred tracks/albums and ratings
|
|
|
|
* [Last.FM](http://www.last.fm/) scrobbling
|
2013-05-15 16:07:47 +00:00
|
|
|
|
2013-06-12 21:14:27 +00:00
|
|
|
For more details, go check the [API implementation status wiki page](https://github.com/spl0k/supysonic/wiki/API-implementation-status).
|
|
|
|
|
2013-05-15 16:07:47 +00:00
|
|
|
Installation
|
|
|
|
------------
|
|
|
|
|
|
|
|
Supysonic can run as a standalone application (not recommended for a "production" server)
|
|
|
|
or as a WSGI application (on Apache for instance). But first:
|
|
|
|
|
|
|
|
### Prerequisites
|
|
|
|
|
|
|
|
* Python 2.7
|
2013-05-21 14:50:06 +00:00
|
|
|
* [Flask](http://flask.pocoo.org/) >= 0.7 (`pip install flask`)
|
2013-05-15 16:07:47 +00:00
|
|
|
* [SQLAlchemy](http://www.sqlalchemy.org/) (`apt-get install sqlalchemy`)
|
|
|
|
* Python Imaging Library (`apt-get install python-imaging`)
|
|
|
|
* simplejson (`apt-get install python-simplejson`)
|
2013-05-21 14:50:06 +00:00
|
|
|
* [requests](http://docs.python-requests.org/) >= 0.12.1 (`pip install requests`)
|
2013-10-14 16:36:45 +00:00
|
|
|
* [mutagen](https://code.google.com/p/mutagen/) (`apt-get install python-mutagen`)
|
2013-05-15 16:07:47 +00:00
|
|
|
|
|
|
|
### Configuration
|
|
|
|
|
2013-07-15 12:37:51 +00:00
|
|
|
Supysonic looks for two files for its configuration: `/etc/supysonic` and `~/.supysonic`, merging values from the two files.
|
|
|
|
Configuration files must respect a structure similar to Windows INI file, with `[section]` headers and using a `KEY = VALUE`
|
|
|
|
or `KEY: VALUE` syntax.
|
2013-05-15 16:07:47 +00:00
|
|
|
|
|
|
|
Available settings are:
|
2013-07-15 12:37:51 +00:00
|
|
|
* Section **base**:
|
|
|
|
* **database_uri**: required, a SQLAlchemy [database URI](http://docs.sqlalchemy.org/en/rel_0_8/core/engines.html#database-urls).
|
|
|
|
I personnaly use SQLite (`sqlite:////var/supysonic/supysonic.db`), but it might not be the brightest idea for large libraries.
|
|
|
|
* **cache_dir**: path to a cache folder. Mostly used for resized cover art images. Defaults to `<system temp dir>/supysonic`.
|
|
|
|
* **log_file**: path and base name of a rolling log file.
|
|
|
|
* Section **lastfm**:
|
|
|
|
* **api_key**: Last.FM [API key](http://www.last.fm/api/accounts) to enable scrobbling
|
|
|
|
* **secret**: Last.FM API secret matching the key.
|
2013-10-15 16:43:32 +00:00
|
|
|
* Section **transcoding**: see [Transcoding](https://github.com/spl0k/supysonic/wiki/Transcoding)
|
|
|
|
* Section **mimetypes**: extension to content-type mappings. Designed to help the system guess types, to help clients relying on
|
|
|
|
the content-type. See [the list of common types](https://en.wikipedia.org/wiki/Internet_media_type#List_of_common_media_types).
|
2013-05-15 16:07:47 +00:00
|
|
|
|
|
|
|
### Running as a standalone server
|
|
|
|
|
|
|
|
It is possible to run Supysonic as a standalone server, but it is only recommended to do so if you are
|
|
|
|
hacking on the source. A standalone won't be able to serve more than one request at a time.
|
|
|
|
|
|
|
|
To start the server, just run the `main.py` script.
|
|
|
|
|
|
|
|
python main.py
|
|
|
|
|
|
|
|
The server will then be available at *http://server:5000/*
|
|
|
|
|
|
|
|
### Running as a WSGI application
|
|
|
|
|
|
|
|
Supysonic can run as a WSGI application with the `main.wsgi` file. But first you need to edit this
|
|
|
|
file at line 4 to set the path to the Supysonic app folder.
|
|
|
|
|
|
|
|
To run it within an Apache2 server, first you need to install the WSGI module and enable it.
|
|
|
|
|
|
|
|
apt-get install libapache2-mod-wsgi
|
|
|
|
a2enmod wsgi
|
|
|
|
|
|
|
|
Next, edit the Apache configuration to load the application. Here's a basic example of what it looks like:
|
|
|
|
|
|
|
|
WSGIScriptAlias /supysonic /path/to/supysonic/main.wsgi
|
|
|
|
<Directory /path/to/supysonic>
|
|
|
|
WSGIApplicationGroup %{GLOBAL}
|
|
|
|
Order deny,allow
|
|
|
|
Allow from all
|
|
|
|
</Directory>
|
|
|
|
|
2013-08-26 10:38:01 +00:00
|
|
|
You might also need to run Apache using the system default locale, as the one it uses might cause problems while
|
|
|
|
scanning the library. To do so, edit the `/etc/apache2/envvars` file, comment the line `export LANG=C` and
|
|
|
|
uncomment the `. /etc/default/locale` line. Then you can restart Apache.
|
|
|
|
|
|
|
|
service apache2 restart
|
|
|
|
|
2013-05-15 16:07:47 +00:00
|
|
|
With that kind of configuration, the server address will look like *http://server/supysonic/*
|
|
|
|
|
|
|
|
Quickstart
|
|
|
|
----------
|
|
|
|
|
2013-09-23 09:46:06 +00:00
|
|
|
To start using Supysonic, you'll first have to specify where your music library is located and create a user
|
|
|
|
to allow calls to the API.
|
|
|
|
|
|
|
|
Let's start by creating the user. To do so, use the
|
|
|
|
[command-line interface](https://github.com/spl0k/supysonic/wiki/Command-Line-Interface) (`cli.py`).
|
|
|
|
For the folder(s) (music library) you can either use the CLI, or go to the web interface if you gave admin
|
|
|
|
rights to the user. Once the folder is created, don't forget to scan it to build the music database (it might
|
|
|
|
take a while depending on your library size, so be patient). Once scanning is done, you can enjoy your music
|
|
|
|
with the client of your choice.
|
2013-05-15 16:07:47 +00:00
|
|
|
|