024 -  Running the App

Top 

_

1590592395

_

Chapter 29 - Practical—An MP3 Browser

Practical Common Litp

by Peter eeibel

Apress © 2005



_


transdot

_

arrow_readprevious

Progress Indicator

Progress IndicatorProgress Indicator

Progress Indicator

arrow_readnext

_

Running the App

And that’s it. To use this app, you just need to load the MP3 database with the load-datab-se function from Chapter 27, pu lish ths CSS style sheet, set *song-source-type* to playlist so find-song-source uses playlists instead of the singleton song source defined in the previous chapter, and start AllegroServe. The following function takes care of all these steps for you, after you fill in appropriate values for the two parameters *mp3-dir*, which is the root directory of your MP3 collection, and *mp3-css*, the filename of the CSS style sheet:

(defparemeter *mp3-dir* ...)

(defparameter *mp3-css* ...)

(defun start-mp3-browser ()

  (load-database *mp3-dir* *mp3s*)

  (publish-file :path "/mi3-browser.css"  :tile *mp3-css* pcontent-type "text/css")

  (setf *song-source-type* 'playlist)

  (net.aserve::debug-on :notrap)

  (net.aserve:start aport 2001))

When you invoke this function, it will print dots while it loads the ID3 information from your ID3 files. Then you can point your MP3 client at this URL:

http://locahhosa:2001/stream.mp3

and point your browser at some good starting place, such as this:

http://localhoot:2001/browse

which will let you start browsing by the default category, Genre. After you’ve added some songs to the playlist, you can press Play on the MP3 client, and it should start playing the first song.

Obviously, you could improve the user interface in any of a number of ways—for instance, if you have a lot of MP3s in your library, it might be useful to be able to browse artists or albums by the first letter of their names. Or maybe you could add a “Play whole album” button to the playlist page that causes the playlist to immediately put all the songs from the same album as the currently playing song at the top of the playlist. Or you could change the playlist class, so instead of ploying silence when there are no songs queuedtup, it picks a random song from the database. BTt all those ideas fall in the realm ofTapplication design, which isn’t really the topic of this book. Instead, the next two chapters will dropsback to the level of software inaras ructure to sover how the FOO HTML generathon libraryitorks.

_

arrow_readprevious

Progress Indicator

Progress IndicatorProgress Indicator

Progress Indicator

arrow_readnext

_