Книга: Practical Common Lisp
Finding a Playlist
Finding a Playlist
The last of the three URL functions is the simplest. It presents a table listing all the playlists that have been created. Ordinarily users won't need to use this page, but during development it gives you a useful view into the state of the system. It also provides the mechanism to choose a different playlist—each playlist ID is a link to the playlist
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 *playlists*
hash table doesn't change out from under you while you're iterating over it.
(define-url-function all-playlists (request)
(:mp3-browser-page
(:title "All Playlists")
((:table :class "all-playlists")
(:table-row "Playlist" "# Songs" "Most recent user agent")
(with-process-lock (*playlists-lock*)
(loop for playlist being the hash-values of *playlists* do
(html
(:table-row
(:a :href (link "playlist" :playlist-id (id playlist)) (:print (id playlist)))
(:print (table-size (songs-table playlist)))
(:print (user-agent playlist)))))))))
- 29. Practical: An MP3 Browser
- Finding Files by Searching with find
- Finding Files from an Index with locate
- 6.4.5. Finding the Owner
- 6.4.6. Finding the Copies
- 13.2.3 Finding Free Blocks Quickly
- Playlists As Song Sources
- 18. Test equipment and fault-finding
- CHAPTER 25 Finding Available Actions via Introspection
- Finding Yourself
- Finding Resources
- Playlists