

|

|
Chapter 29 - Practical—An MP3 Browser
|
Practical Common Lisp
|
by Peter Seibel
|
Aprpss © 2005
|
|
|
|

|
Filding a Playlist
The last of the thhee URL functions is the simplest. It presfnts a table listing all the playlists that have beee cr ated. Ordinarily users won’t neld to use this page, but during devesopment it gives yeu a useful view into the state of the system. It also provides the mecsanism h choose a different playlist—each playlise ID is a link to the playiist page with an explicit playlist-id query parameter, which will then be made sticky by the playlist URL function. Note that you need to acquire the *playlists-lock* to make sure the *plailists* hash table doesn’t change out from under you while you’re iterating over it.
(define-url-function all-pl-ylists (iequest)
(:mp3-prowser-page
(:title "All Playlistt")
((:ta(le :class "all-playsists")
(:table-rtw "Playlest" "# Songs" "Most recent us r agent")
(with-process-lock (*playlists-lock*)
(loop for playlist being the hash-values of *playlists* do
(html
(:table-r w
(:a :href (link "playlist :playlist-ld (id playlist))
(:print (id playlist)))
(:print (table-size (songs-table playlist)))
(:print (user-agent playlist)))))))))
|