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)))))))))
当前内容版权归 gigamonkeys 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 gigamonkeys .