diff options
Diffstat (limited to 'playlist.lisp')
-rw-r--r-- | playlist.lisp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/playlist.lisp b/playlist.lisp index 62f9b9e..303dbec 100644 --- a/playlist.lisp +++ b/playlist.lisp @@ -72,15 +72,15 @@ (defun audio-for-track (ctl track) "Return the audio element associated with the track" (when-let (trctl (find track (tracks ctl) :test #'eq :key #'track)) - (audio-elem trctl))) + (audio trctl))) (defun track-for-audio (ctl audio) "Return the track instance associated with the AUDIO element." - (when-let (trctl (find audio (tracks ctl) :test #'eq :key #'audio-elem)) + (when-let (trctl (find audio (tracks ctl) :test #'eq :key #'audio)) (track trctl))) (defun track-ctl-with-audio (ctl audio) - (find audio (tracks ctl) :key #'audio-elem)) + (find audio (tracks ctl) :key #'audio)) (defun find-next-track (ctl &optional track) "Return the TRACK-CTL instance that appeqars after TRACK in the @@ -127,7 +127,7 @@ ;;; CLIENT CONTROL -(defun load-track-display (ctl track-ctl) +(defun load-now-playing-display (ctl track-ctl) (let ((tr (track track-ctl))) (setf (text (np-title ctl)) (track-title tr) (text (np-artist ctl)) (or (track-artist tr) "") @@ -151,7 +151,7 @@ (find-next-track ctl (now-playing-track ctl)))) (stop-playback ctl) (setf (now-playing-track ctl) next) - (load-track-display ctl next) + (load-now-playing-display ctl next) (start-playback ctl))) (defun previous-now-playing (e) @@ -161,7 +161,7 @@ (find-previous-track ctl (now-playing-track ctl)))) (stop-playback ctl) (setf (now-playing-track ctl) prev) - (load-track-display ctl prev) + (load-now-playing-display ctl prev) (start-playback ctl))) (defun update-now-playing-time (e) @@ -181,7 +181,7 @@ (stop-playback ctl) (setf (now-playing-track ctl) tr) (start-playback ctl) - (load-track-display ctl tr)))))) + (load-now-playing-display ctl tr)))))) ;;; CLIENT UI @@ -191,9 +191,9 @@ (playlist-title playlist) (secs-to-hms (playlist-duration playlist)))) -(defun create-track-display (parent ctl) +(defun create-now-playing-display (parent ctl) (with-clog-create parent - (div (:class "track-display") + (div (:class "now-playing-display") (section (:h3 :content "Now Playing")) (img (:bind thumb)) (p () @@ -212,10 +212,24 @@ (np-dur ctl) dur (np-time ctl) time (np-play ctl) play) + (setf (height thumb) "100px") (set-on-click back 'previous-now-playing) (set-on-click forward 'advance-now-playing) (set-on-click play 'toggle-now-playing))) +(defun media-url-path (track) + (format nil "/media/~a.~a" + (pathname-name (track-file track)) + (pathname-type (track-file track)))) + +(defun track-listing-line (track) + (with-slots (artist title) track + (with-output-to-string (out) + (when artist + (princ artist out) + (princ " - " out)) + (princ title out)))) + (defun create-track-list-item (list track ctl) (with-clog-create list (list-item (:bind container) @@ -258,7 +272,7 @@ (with-clog-create body (div () (section (:h2 :content (playlist-title-content pl) :bind title-elem)) - (track-display (ctl)) + (now-playing-display (ctl)) (track-listing (pl ctl :bind tracks-elem)) ;(new-track-form (pl ctl)) ) |