Saturday, December 31, 2005

Have your own Streaming Mp3 Server - edna

Edna - allows you to access your MP3 collection from any networked computer. This software streams your MP3s via HTTP to any MP3 player that supports playing off a remote connection (e.g. Winamp, FreeAmp, Sonique, XMMS).

While any silly web server can do this (serve up MP3s), there are two cool features about edna:

  • The pages are dynamically constructed, adjusting to directory structure and the files in those directories. This is much nicer than using simple directory indexing. While the dynamic file list could be done with various CGI or PHP-like tools, the dynamic directories would be a lot harder.
  • This is the coolest part... Rather than directly serving up an MP3, the software serves up a playlist. This gets passed to your player (e.g. WinAmp) which turns around with an HTTP request to stream the MP3. I must give credit to Geoff for this one :-)
Installation Guide :

Please make sure you have Python installed in your server, I had python-2.3.


1. Create a directory in /home :

mkdir /home/mp3


2. Go to the Directory

wget http://edna.sourceforge.net/edna-0.5.tar.gz


3. Extract the downloaded file

tar -zxvf edna-0.5.tar.gz



4. Go into the fresh directory and edit the edna.conf

#
# edna.conf -- configuration file for edna.py
#

[server]
port = your.port.here

### DOCCO
# ### change these if the defaults don't work...
# template-dir = templates
# template = default.ezt

# If you want id3 tags, use default_complex.ezt
# template = default_complex.ezt
# Enable costly file information if needed (default disabled)
# fileinfo=1

### DOCCO
# binding-hostname = dummy-host.example.com
# binding-hostname = 123.123.123.123


# log can specify "-" for stdout, or a file name. omitting this line
# produces no log.
log = /var/log/edna.log

acl]
### DOCCO
#allow = host1, host2, host3/24, 123.123.123.123, 2.2.2.2/11
#auth = aUser1:aPass1, aUser2:aPass2

#Require password for directories < level ..
# Work around for buggy players that can't send authentication information
# 0 Only check '/'
# 1 Check all levels (default)
# auth_level=0

[sources]
#
# List each source directory (top of the tree). The lines should be of the
# form:
# dirNNN = DIRECTORY = DISPLAY_NAME
#
# WARNING: the DISPLAY-NAME part may *not* have a slash ("/") in it!
# WARNING: each DIRECTORY must exist when edna is started
#
# The NNN part will determine the sort order in the top-level listing.
#

# Windows example:
#dir1 = f:\mp3\transfer = MP3s
#dir2 = f:\bobsmp3 = Bob
#dir3 = g:\MP3's = Bob CD

# Unix example:
#dir1 = /mnt/cdrom = MP3 CDROM
dir1 = /home/mp3/albums = Jukebox

[extra]
# Extra options
#
# You don't need to change this, but maybe you need more
output or want to enable some special features

# Set this to 1 to get more output
debug_level = 0

# Mark all files as new if they are newer than days_new

days_new = 30




5. Create your jukebox dir

mkdir /home/mp3/albums

6. Change back to main /home dir and issue the command

chown -R apache:apache /home/mp3

7. Edit the /etc/rc.local file
vi /etc/rc.local

8. Add

# Starting Edna Jukebox Server
echo "Starting Edna Jukebox Server"
cd /home/mp3/edna ; sudo -u apache python edna.py &


9. Start your server

cd /home/mp3/edna ; sudo - u apache python edna.py &


10. Create dir/s under /home/mp3/albums

Eg. English, Hindi, Tamil etc ...

anc copy all your songs accordingly

11. Access your songs from browser :

http://localhost:8080

8080 is the default port you can change the port to some other in edna.conf


Some points :

Edna is a simple python script

It does not use apache server at all.

Please make sure you do not run it as root, you can use any other normal user to run this.