brownan / G2

Internet Jukebox web-app. Run your own radio station with a shared playlist
15 stars 8 forks source link

G2

Original code by Jonnty http://gbs.fm/bugs

G2 is a web-app to manage a playlist for a Shoutcast (or compatible) streaming media server.

G2 acts as an internet jukebox. Listeners upload and add songs to a shared playlist. You can also vote for and comment on the music that's playing!

If you're a Something Awful forums member, see this thread for the goon-run gbs.fm, powered by G2: http://forums.somethingawful.com/showthread.php?threadid=3337579

If you want to get G2 running for yourself, keep reading!

Prerequisites

To install this, it probably helps to know Django well enough to configure and deploy a project. You'll also be needing to dabble in shoutcast or icecast, so that'll also help. Oh, and also mysql.

Requirements

Install these packages, for they are required for a functioning installation

to build icecast, you'll also need to install (ubuntu packages, other distros may vary):

Python packages to install

You can pip-install these, but make sure they're installed somehow

Setting up G2

The repository is a django project. It must be in a directory called "pydj", various imports depend on it.

Mysql

Create a mysql database and user, give that user full access to the database

settings.py

Create yourself a settings.py file. The easiest way is to copy the template from::

<django root>/conf/project_template/settings.py

Then follow these steps. They are all necessary, optional steps are listed later.

Other directives, not documented yet

They're not strictly necessary for a working install, but may do something interesting. I haven't gotten around to documenting this yet

Post Config

Now that your settings.py is nice and configured, run

::

python manage.py syncdb

to populate the database. Create yourself an admin user when propmpted.

Now deploy the site with apache+mod_wsgi, or lighttpd, or the django built in server, or whatever. This is left as an excercise to the reader.

A wsgi file is provided under the apache directory.

Note: you may need to add some creative path additions to the top of some files. If you have custom paths to add, do so to these files:

Database setup

Before you can use the site, a couple things need to be added to the database. Head to the admin site at /admin

Adding Users

Currently, adding users is a manual process. I stripped out the original Something Awful integrated login used at gbs.fm, but haven't added anything in its place.

To add a user, head to the admin page and follow these steps:

Shoutcast/Icecast Setup

Set up a shotcast or icecast server. On ubuntu, these steps suffice:

Icecast is now running on port 8000. Remember that, and the password you used for the next step.

ICES Setup

The web app is all set up, but you still need to get ices set up

If all works, things are now streaming! Otherwise, check the ices logs in the logic directory and the shoutcast/icecast logs for clues.

FTP Setup

Downloading Files

If a user has the "playlist.download_song" permission, they will have a link on each song page to download the file. This link depends on the webserver supporting the X-Sendfile header. For Apache, get the mod_xsendfile module.

For Ubuntu, you can install the libapache2-mod-xsendfile module. Make sure to turn it on in the server configuration with XSendFile On. If you get errors about the path being above the root, you can bypass the check with XSendFileAllowAbove On. (This option was removed in favor of XSendFilePath in 1.0, but Ubuntu still ships 0.9. See the documentation on XSendFile for more info)