summaryrefslogtreecommitdiff
path: root/playlist.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'playlist.lisp')
-rw-r--r--playlist.lisp31
1 files changed, 19 insertions, 12 deletions
diff --git a/playlist.lisp b/playlist.lisp
index 7a2884b..b52a0a7 100644
--- a/playlist.lisp
+++ b/playlist.lisp
@@ -12,8 +12,8 @@
(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-dur
- :std nil :doc "Playlist Elements")
+ (pl-title pl-tracks pl-dur pl-zip
+ :std nil :doc "Playlist Elements"))
(:documentation "Holds the complete state for this session's viewing of a particular playlist."))
(defclass/std track-ctl ()
@@ -64,7 +64,6 @@
(setf (cur-playlist-ctl body)
(make-instance 'playlist-ctl
:playlist playlist
- :zipped-tracks (when (zipped-playlist-exists-p playlist) (zipped-playlist-url playlist))
:editorp (can-edit-p (session-user body) playlist))))
;;; SYNCHRONIZATION
@@ -190,7 +189,7 @@
(pos (position track-ctl (tracks curctl))))
(when (delete-track-at (playlist curctl) pos)
- (delete-zipped-playlist (playlist curctl))
+ (delete-zipped-playlist curctl)
(for-playlist-viewers container ctl
(let ((track-ctl (nth pos (tracks ctl))))
(destroy (container track-ctl))
@@ -201,7 +200,7 @@
(when-let* ((curctl (cur-playlist-ctl (container track-ctl)))
(pos (position track-ctl (tracks curctl))))
(when (swap-tracks (playlist curctl) pos (1+ pos))
- (delete-zipped-playlist (playlist curctl))
+ (delete-zipped-playlist curctl)
(for-playlist-viewers (container track-ctl) ctl
(let* ((cur
(nth pos (tracks ctl)))
@@ -217,7 +216,7 @@
(when-let* ((curctl (cur-playlist-ctl (container track-ctl)))
(pos (position track-ctl (tracks curctl))))
(when (swap-tracks (playlist curctl) pos (1- pos))
- (delete-zipped-playlist (playlist curctl))
+ (delete-zipped-playlist curctl)
(for-playlist-viewers (container track-ctl) ctl
(let* ((cur
(nth pos (tracks ctl)))
@@ -351,7 +350,7 @@
(on-ok
(lambda (track)
(destroy notice)
- (delete-zipped-playlist pl)
+ (delete-zipped-playlist (cur-playlist-ctl parent))
(append-track pl track)
(append-track-list-item parent track))))
(setf (value url-input) "")
@@ -442,17 +441,25 @@
(track-listing (pl))))
(div (:class "row")
- (div ()
- (button (:content "Download Zipped Playlist" :bind zip-download-button)))
+ (div (:class "column")
+ (button (:content "Create Zipped Playlist" :bind zip-download-button)))
(div ()
(new-track-form (pl))
(editor-managment (pl)))))
(set-on-click zip-download-button
- (thunk* (zip-playlist pl)
- (setf (url (location body)) (zipped-playlist-url pl))))
+ (thunk*
+ (add-zip-playlist-job
+ pl
+ (lambda (_) (declare (ignore _))
+ (let ((zip-link (make-zipped-playlist-link pl body)))
+ (setf (pl-zip ctl) zip-link)
+ (place-after zip-download-button zip-link)))
+ (lambda (err)
+ (print (format t "~a" err))))))
(setf (pl-title ctl) title-elem
(pl-dur ctl) dur-elem
+ ;; (inner-html download-elem) (pl-zip ctl)
(display input) "none"
(display title-elem) "inline")
@@ -472,7 +479,7 @@
input
(thunk*
(when (plusp (length (value input)))
- (delete-zipped-playlist pl) ;; must happen first
+ (delete-zipped-playlist ctl) ;; must happen first
(update-playlist-title pl (value input))
(setf (text title-elem) (value input)))
(setf (display input) "none"