diff options
-rw-r--r-- | playlist.lisp | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/playlist.lisp b/playlist.lisp index c1c063a..64b03ef 100644 --- a/playlist.lisp +++ b/playlist.lisp @@ -78,11 +78,12 @@ (defclass/std playlist-ctl () ((playlist :std nil :doc "The playlist instance.") + (tracks :std nil :doc "A list of instances of track/client") (now-playing-track :std nil :doc "An instance of track-ctl") (np-title np-artist np-thumb np-dur np-time np-play :std nil :doc "Now Playing Elements") - (pl-title pl-tracks + (pl-title pl-tracks pl-dur :std nil :doc "Playlist Elements")) (:documentation "Holds the complete state for this session's viewing of a particular playlist.")) @@ -215,9 +216,9 @@ (defun remove-track (track-ctl) (when-let ((ctl (get-playlist-ctl (container track-ctl)))) (when (delete-track-at (playlist ctl) (position track-ctl (tracks ctl))) - (setf (tracks ctl) - (delete track-ctl (tracks ctl))) - (destroy (container track-ctl))))) + (destroy (container track-ctl)) + (setf (tracks ctl) (delete track-ctl (tracks ctl)) + (text (pl-dur ctl)) (secs-to-hms (playlist-duration (playlist ctl))))))) (defun move-track-down (track-ctl) (when-let* ((ctl (get-playlist-ctl (container track-ctl))) @@ -328,7 +329,9 @@ (defun append-track-list-item (obj track) (when-let (ctl (get-playlist-ctl obj)) - (create-track-list-item (pl-tracks ctl) track ctl))) + (create-track-list-item (pl-tracks ctl) track ctl) + (setf (text (pl-dur ctl)) + (secs-to-hms (playlist-duration (playlist ctl)))))) (defun create-new-track-form (parent pl) (with-clog-create parent @@ -339,6 +342,7 @@ (button (:content "Fetch Track" :bind button)) (div (:bind notice-area))) (label-for url-label url-input) + (setf (size url-input) (length "https://www.youtube.com/watch?v=dQw4w9WgXcQ")) (setf (place-holder url-input) "https://www.youtube.com/watch?v=dQw4w9WgXcQ") (set-on-click button @@ -376,14 +380,19 @@ (install-new-playlist-ctl pl body))) (with-clog-create body (div () - (section (:h2 :content (playlist-title pl) :bind title-elem)) - (form () - (form-element (:text :bind input))) + (section (:h2) + (:span (:bind title-elem :content (playlist-title pl))) + (form-element (:text :bind input)) + (:span (:content " -- ")) + (:span (:bind dur-elem :content (secs-to-hms (playlist-duration pl))))) + (now-playing-display (ctl)) (track-listing (pl)) (new-track-form (pl))) (setf (pl-title ctl) title-elem - (display input) "none") + (pl-dur ctl) dur-elem + (display input) "none" + (display title-elem) "inline") (set-on-blur input @@ -392,14 +401,14 @@ (update-playlist-title pl (value input)) (setf (text title-elem) (value input))) (setf (display input) "none" - (display title-elem) "block"))) + (display title-elem) "inline"))) (set-on-click title-elem (alambda (setf (value input) (text title-elem) - (display input) "inline" - (display title-elem) "none") + (display title-elem) "none" + (display input) "inline") (focus input))) (initialize-now-playing body))))) |