1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-11-14 22:22:18 +00:00
Go to file
2013-12-14 14:51:14 -05:00
api Merge branch 'master' of github.com:spl0k/supysonic 2013-12-14 14:51:14 -05:00
managers made more debug friendly, added accel-redirect support, added 2013-11-26 02:59:08 -05:00
templates Handle client prefs changes 2013-12-08 16:20:43 +01:00
.gitignore debug mode only for db echo on cli 2013-12-06 03:30:40 -05:00
cli.py Added an 'exit' command to the CLI 2013-11-03 16:02:53 -05:00
config.py Better handling of config files using python ConfigParser 2013-07-15 14:38:24 +02:00
db.py Merge branch 'master' of github.com:spl0k/supysonic 2013-12-14 14:51:14 -05:00
folder.py improve scanning and added debug messages for scanning 2013-11-03 20:43:16 -05:00
lastfm.py Better handling of config files using python ConfigParser 2013-07-15 14:38:24 +02:00
main.py MySQL support 2013-07-15 20:30:33 +02:00
main.wsgi some status messages for scan and flush database more often during scan 2013-11-01 14:46:16 -04:00
playlist.py Basic playlist management from the web interface 2013-06-27 19:41:06 +02:00
README.md Added configurable extension whitelist on the scanner 2013-11-03 16:03:34 -05:00
scanner.py Merge remote-tracking branch 'upstream/master' 2013-12-06 03:39:39 -05:00
supysonic.ini made more debug friendly, added accel-redirect support, added 2013-11-26 02:59:08 -05:00
user.py Handle client prefs changes 2013-12-08 16:20:43 +01:00
web.py made more debug friendly, added accel-redirect support, added 2013-11-26 02:59:08 -05:00

Supysonic

Supysonic is a Python implementation of the Subsonic server API.

Current supported features are:

  • browsing (by folders or tags)
  • streaming of various audio file formats
  • transcoding
  • user or random playlists
  • cover arts (cover.jpg files in the same folder as music files)
  • starred tracks/albums and ratings
  • Last.FM scrobbling

For more details, go check the API implementation status wiki page.

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
  • Flask >= 0.7 (pip install flask)
  • SQLAlchemy (apt-get install sqlalchemy)
  • Python Imaging Library (apt-get install python-imaging)
  • simplejson (apt-get install python-simplejson)
  • requests >= 0.12.1 (pip install requests)
  • mutagen (apt-get install python-mutagen)

Configuration

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.

Available settings are:

  • Section base:
    • database_uri: required, a SQLAlchemy database URI. 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.
    • scanner_extensions: space-separated list of file extensions the scanner is restricted to. If omitted, files will be scanned regardless of their extension
  • Section lastfm:
    • api_key: Last.FM API key to enable scrobbling
    • secret: Last.FM API secret matching the key.
  • Section transcoding: see 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.

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>

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

With that kind of configuration, the server address will look like http://server/supysonic/

Quickstart

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