MP3Mystic - v1.00
By Jason Rahaim Jason@mp3it.net
http://www.MP3Mystic.com/

Introduction

In October of 2000 I was sitting at work, hammering on some Delphi code, and I hit a road block. It's at that point I cursed myself for not lugging my transportable MP3 player into work. I surfed a couple of MP3 sites, and Internet radio stations, and it got me through the day.... But, it just wasn't my music. That evening I installed an apache server on my mp3 player. But I couldn't get the music to stream. I could download the song, but no streaming. I did some research and found out that I needed to generate .m3u files for each song. 

Well I once heard that if you give a lazy man a tough job he will find an easy way to do it. I'm not sure that this was the easy way, but the end result was a stand alone web server that just serves and streams mp3 files and play lists. The only files that are served are mp3's and m3u's (and directories).

Installation

Unzip the two files into their own directory. Run the mp3mystic.exe. Tada!

Cost

MP3Mystic comes in 3 versions. The free version is a fully functional Personal web server allowing one connection at a time. For $14.95 you can upgrade MP3Mystic to be fully configurable, and allow an additional connection. For $29.95 you can add the ability to serve multiple directories/drives as well as support for unlimited connections. You may distribute this program freely, but you may NOT share Registrations codes. 

Setup

Start the server app, and choose settings. 

Supervisor User name/password: This is the username/password pair for access to the Logs, Stats, and Shutdown commands.

Require Login to Access Server: Causes MP3Mystic to require a username/password for anyone accessing the server. If this is checked you will be prompted for a username/password.

Server name: This is displayed at the top of each screen. For example "Jason's MP3 Player".

Route Path: this is the path to the route of your mp3 files. For example "c:\my music". ALL directories below this will be browse able. For registered versions use the Semi-Colon to separate multiple paths.

Port: The IP port to listen on. The default port for web servers is 80. 

Start Server on Launch: if this is checked the server will start when the application is started. If this is not checked you must chose start from the main menu.

Default HTML Tab
Support ID3v1: Allows the server to use and display ID3 information for files. Please note: This will slow the system down slightly.

IPs tab
"allow all IPs except" - Default. This option lets the world connect to your server, EXCEPT for the IPs listed in the box below.

"deny all IPs Except" - This option shuts the world out of your server except for the IPs listed in the IP box.
If you type in a partial IP address (ie "192.168.") It will allow/deny the whole block. 

Advanced Tab (You don't need to mess with this to get your server running)
Music Types: File Extensions that you want MP3Mystic to serve, that CAN be streamed. Files with these extensions will have play lists automatically generated for them. (Example MP3, OGG, Etc.). 

File Types: Files you want users to be able to down load from your site that are not streamable. These might include pictures (JPG, GIF, etc), text files, documents. M3Us must be listed here. Types MUST be separated by Semicolons or colons.

Display "Download": Turning this off will hide the "download" link on all generated web pages. This doesn't actually prevent people form downloading music, since they can always type in the path by hand. Disable the downloading of music would also cause Winamp to stop functioning.

Display "Listen": Turning this off will hide the "stream" link on all generated web pages.


Main Screen

The status bar (at the bottom of the screen) shows lots of random information. The first block shows 3 numbers. In the format 1/2/3. The first number is the number of current connections. The second number is the Maximum number of concurrent connections, and the third number is the total number of connections. 

The second box on the status bar shows weather the server is active or not, and if it is active (and someone has connected to it) it shows the web address of the server. This is purely for debugging purposes. 
The main screen shows information about the most recent connection. This screen is purely for debugging, and if you have problems I will most likely ask for information from that screen. 


Accessing the server:

Ok, so you have the server running. Now what. If you are on the same machine as the server you can launch a browser, and connect to http://127.0.0.1/ (if you chose the default port of 80, if you chose a different port for example 8080 you would type. http://127.0.0.1:8080/ 

Searching, the first time a search is run (each time the server is started) the system searches your entire directory structure (below the route drive you specified in your settings). After that, searches used that cached directory to do searches. If you add music to your library, searches will NOT reflect the changes until you restart the server. Browsing does NOT have that limitation.

Special Pages: (the supervisor username and password are required to access these pages)
_log - Shows a log of ALL accesses to the server (logs are kept in c:\)
_stats - Shows the most frequently access files.
_shutdown - Shuts the server down. (there is no way to restart it remotely). 
_restart - Restarts the web server.
_users - Add/remove IP addresses/blocks.
_version - Returns the current version string. (User/password not reuired)
_rebuild - Rebuilds the search cache.
_access - Summarizes server accesses by IP address.
For example http://127.0.0.1/_log 


Templates: (These are complete OPTIONAL and for advanced users only.)

The Server Defaults to "index.htm" if no name is entered in the URL. ("http://127.0.0.1/" as an example)
The server will serve HTML (.htm and .html) files from the 'Route Path' (not any subdirectories). Server side commands support are:

<MP3FILES> List of mp3 files and directories.
If you want to use ID3 information instead of filenames, the format is <MP3FILES="id3str"> where id3str con consist of any characters/symbols with the following special codes (this are the same codes that Winamp uses)
%1 - Artist
%2 - Title
%3 - Album
%4 - Year
%5 - Comment
%6 - Genre
%7 - File name
%8 - Directory
%9 - File extension
%s - File Size
Example <MP3FILES="%2 - %1 %3 (%s)">
<MP3PATH> Relative path to the current directory. If the page was generated as a result of a search the text will be "Search results " plus the search string.
<MP3SEARCHSTR> Search string. This is should only be used if you have special page for search results (as opposed to just using the same page as your browsing page. This returns JUST the search string.
<MP3SEARCH> the MP3 file search box.
<MP3SEARCH=target.htm> Specify a html file to display the results of the search with. If you don't use this then index.htm will be used. Your target html page must exist in the route directory and must have a <MP3FILES> tag in order to display results.
<MP3STATS> Display the most frequently downloaded files.
<MP3CONCUR> Display the current number of active connections.
<MP3CONMAX> Display the maximum number of concurrent connections.
<MP3CONTOT> Show the current number of connections.
<MP3VERSION> Display the Current Version Number.
<MP3SERVERNAME> Display the Server name as entered in the Config screen.

Example file: 
(save this to index.htm in your 'route path' directory then browse to http://127.0.0.1/ )
<html><head><title>mp3Mystic test Page</title></head>
<body bgcolor="#000000" text="#FF00FF">
<h1 align="center"><font face="Andale Mono">Test!</font></h1>
<MP3SEARCH>
<HR>
<MP3FILES>
</body>
</html>

General Warnings:

This is a web server, you will be giving people access to your files by running this software. By Design it ONLY serves mp3 and m3u files. I believe it to be well behaved in this manner. But, be careful.

I do not believe there is a way to get access to anything outside of the route directory you specify, be careful creating shortcuts in the route directory you setup. Crackers are VERY resourceful. 

This server does not, nor will it ever send information out to the world about its existence. (for example it will not ping me to tell me you are running it, and what the address is). But, people/isps do scan random addresses and ports. You have been warned.

I am willing to share my source code with trusted members of the development community so they may verify security issues.

Jason Rahaim
Jason@mp3it.net

Changes:
V 1.00	Released!
V1 RC 02 Release Candidate 2!
Fixed bug: If require password was selected, the Supervisor password was send to Winamp.
Fixed Bug: When I added support for multiple directories, some stuff was broken. It should all work now.
Fixed spacing on ID3 Information passed to winamp's playlist.
V1 RC 01 Release Candidate 1!
Minor tweaks. (e.g. added the version number to the Powered by line)
Removed the time limit! This version does not expire!
Beta 1.13 Implementing Registration
Multiple paths are support (use semi-colons to separate paths)
Registration is now required for ID3v1, Multiple Paths, Custom HTML. Beta testers are eligible for free registration. Email me if you haven't received yours. (You are eligible if you reported a problem, I fixed it, and you confirmed it was fixed) If there are any questions, email me Jason@mp3it.net.
Beta 1.12 Getting ready for RC-1
Added the _access page showing a summary of hits by IP address. This list will get more detailed
Cleaned up the log routines. 
Added IP addresses to the mp3reqst log.
Removed the Memo field on the server screen.
Added file downloading stats (Current, Max, and Total) to the Server screen and to _log.
Changed mp3reqst log paths to be relative.
If ID3 Tags are enabled the Title, Artist, and Album will be displayed in winamp. If ID3 tags are not enabled then the filename will be displayed. Thanks to Chris for the info on this.
Beta 1.11 ID3v1 Search
The search cache is now populated when the server starts up instead of when the first search is triggered.  If you have ID3v1 Tags enabled this process could take a while (450Mhz AMD with 6000 songs it takes about a 2 minutes). You will see the progress on the status bar. The server window will minimize when this search finishes. While the cache is being build the server will be able to serve pages, but streaming music will be choppy, and downloads will be slow.
If you have ID3v1 enabled the search now searches filenames, ID3 Titles, ID3 Albums, and ID3 Artists.
I expanded the list of special characters that the system can handle ( # ~ & ? = ; > <) If you have problems with ANY valid filename character PLEASE report it to me via the web page or email. 
Netscape was failing to navigate directories with spaces in them. This should be fixed now. There are still some problems with netscape, I can't figure out a way to have it save files with spaces in the names instead of the %20s.
Fixed a problem with ID3 Tags. (All fields were shifted slighty.)
Beta 1.10 ID3v1 and Other features
The server now Minimizes to the tray instead of the task bar. I will be creating better icons for it soon (unless someone wants to volunteer some icons You will get credit in the readme, HINT HINT)
ID3v1 Tags have been implemented. They will probably be a feature of the registered version.
Expanded the MP3Files tag to account for ID3v1 Tags.
Fixed the IP numbers to allow for sub blocks.
Added an option to hide the "listen" and/or "download" links
Beta 1.9 Doh!
Adding an overall site password caused a file not found error in Winamp. Fixed.
Beta 1.8 Bugs 'n Features
Search results weren't getting passed to the right HTML page.
Added <MP3PATH> and <MP3SEARCHSTR> Tags.
Beta 1.7 Features.
Added a bunch of TAGs. <MP3STATS>, <MP3CONCUR>, <MP3CONMAX>, <MP3CONTOT>, <MP3VERSION>, and <MP3SERVERNAME>.
Changed MP3SEARCH so it displays on one line.
Added the ability to optionally password the entire site.
Added an about box. Woowoo.
Fixed bug in search (bug caused by Beta 1.6) not returning directories.
Beta 1.6 Optimization.
Large Files were taking forever to start transferring (ie Jethro Tull's Thick as a Brick). They now start instantly.
As a side effect lower machine resources are used. (Read more streams possible).
Added a destination file tag to the MP3Serach tag. Invaluable when creating frames pages.
For Beta and free versions of the software "powered by MP3Mystic" (with a link) will be displayed at the bottom of any page that has the <MP3FILES> tag. It is inserted just before the </body> tag. I think this solution is pretty non-intrusive. If anyone is strongly opposed to it, best I can tell you, is register it. Since I probably will remove that tag in any paid version.
Beta 1.5 Bugs, bugs, bugs
Fixed some more issues with m3u's
Added preliminary support for OGG files (I Still cant get the to stream)
Added support for streaming whole directories.
Beta 1.4 More bug fixes
Filename starting with a Parenthesis ( were seen as a directory. This has been fixed. 
Some m3u files weren't working right, these have been fixed (I believe)
If you didn't have a template file you couldn't transverse up a directory.
_version added to the special pages.
IPs Tab on config documented (briefly)
Beta 1.3 Fixed bugs caused by 1.2
The server would not work if you did not have a template file. FIXED
Beta 1.2 Major Update
INI and LOG files moved into the application directory. LOG and INI files will have to be manually moved.
Template support added. 
_users tag added for ban/allow list.
Added support for banning/allowing IP addresses/blocks
Fixed support for Netscape. Filenames still contain %20s instead of spaces when downloading in Netscape.
_shutdown implementation changed. The first time it stops the server from accepting any non '_' command. The second time it shuts the server down. After the first _shutdown you can use _restart to start accepting connections again.
When changing settings you no longer have to close the application and restart it. As long as there are no active connections it will restart it's self.
Name changed to MP3Mystic.
Beta 1.1 Bug Fix
Exit menu Implemented
Added support for Admin Username/Password
Beta 1 - First Release.
I can listen to my music from work!

To Do - (email Jason@mp3it if there is something you would like added)
Support multiple drives/paths
Better support for downloading in netscape.
Documentation
Support non-displayed file types. (jpg, gif, etc).
Can ID3 Tags be displayed in Winamp for streamed files?

