diff --git a/links.rkt b/links.rkt index 7b7f6b7..6f56eff 100644 --- a/links.rkt +++ b/links.rkt @@ -111,6 +111,11 @@ username (+ 1 page-n)))) +;; Message when we get to the beginning/end of a user's list +(define (no-more username) + (format "No more left

Beginning" + username)) + ;(retrieve-videos "slowbeef") -(provide get-category retrieve-videos) \ No newline at end of file +(provide get-category retrieve-videos no-more) \ No newline at end of file diff --git a/playlist_server.rkt b/playlist_server.rkt index 3c6d5d6..07a921b 100644 --- a/playlist_server.rkt +++ b/playlist_server.rkt @@ -39,10 +39,12 @@ (string->xexpr (let [(username (path/param-path (car (url-path (request-uri req))))) (page-n (hash-ref (list->hash (url-query (request-uri req))) 'p))] - (check-cache (user-cache-params username + (match (positive? (string->number page-n)) + [#t (check-cache (user-cache-params username page-n) (λ () (retrieve-videos username (string->number page-n))) - identity))))) + identity)] + [_ (no-more username)]))))) ;; Adds a new resource to the lazyplay queue (define (add-name req)