225
Chapter 10, Access Your Entire Media Collection Over the Internet
Another idea would be to keep track of usage data. Would you like to
know your own personal top ten? It wouldnt take much to coax the
playlist generator functions to keep track of stuff like that.
You could also place a real database between the files and the applica-
tion, allowing you to keep track of all kinds of things. Doing so makes
it easy to create playlists based on anything from genre to “songs that
start with Q.
Lastly, because I wanted to make it as generic as possible, this project
only plays MP3 files. But because your site is for your own personal use,
you get to call the shots and can easily add other media formats. For
example, you could modify the display and playlist routines to allow
files with an .OGG extension; if you prefer Windows Media Audio files,
add those. This is your site; make it do whatever you want it to.
Exhibit A: default.asp
<%@ LANGUAGE=VBScript %>
<% Option Explicit %>
<!-- #INCLUDE FILE="playlist.asp" -->
<!-- #INCLUDE FILE="display.asp" -->
<%
'Constants
Const MEDIA_LIBRARY_URL = "mp3"
Const MEDIA_LIBRARY_PATH = "c:\media_library"
Const TEMP_URL = "temp"
Const TEMP_PATH = "c:\inetpub\wwwroot\temp"
%>
<html>
<head>
<title>Homehacking MP3 Jukebox for Geeks</title>
</head>
<body>
<%
If Request.QueryString.Count = 0 Then
DisplayArtists
Else
Select Case Request.QueryString("action")
Case "artist"
DisplayAlbums Request.QueryString("artist")
Case "play"
Select Case Request.QueryString("type")
Case "artist"
Response.Redirect GenerateArtistPlaylist(Request.
QueryString("artist"))
Case "album"
Response.Redirect GenerateAlbumPlaylist(Request.
QueryString("artist"), Request.QueryString("album"))
Case "song"
Response.Redirect GenerateSongPlaylist(Request.
QueryString("artist"), Request.QueryString("album"), Request.
Exhibit A
hhpg.indb 225
11/24/2004 1:56:12 PM

Get Home Hacking Projects for Geeks now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.