aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-10-26 11:44:46 -0500
committerColin Okay <colin@cicadas.surf>2022-10-26 11:44:46 -0500
commitb1b3fcf39cdf7bae870d2dbc8eea172ac806f6b2 (patch)
tree046f1cbeda4101b6653b626a9e19da6b729d5895
parent425dc38a6bb93de99bb3f743683591062ed0dac7 (diff)
Fix+Move: separate playlist module
-rw-r--r--keyed.lisp4
-rw-r--r--playlist.lisp34
-rw-r--r--vampire.lisp25
3 files changed, 29 insertions, 34 deletions
diff --git a/keyed.lisp b/keyed.lisp
index b38cfe3..c9978bf 100644
--- a/keyed.lisp
+++ b/keyed.lisp
@@ -5,5 +5,5 @@
(defclass/bknr keyed ()
((key
:r :std (nuid)
- :index-type string-unique-index
- :index-reader object-with-key)))
+ :index-type string-unique-index
+ :index-reader object-with-key)))
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))
)
diff --git a/vampire.lisp b/vampire.lisp
index 8ca4b79..eef75cc 100644
--- a/vampire.lisp
+++ b/vampire.lisp
@@ -19,27 +19,17 @@
;;; RESOURCE MODEL
-
(defclass/bknr user (keyed)
((name :with :std "")
(playlists :with :std (list))
(pw pwhash :with)))
-;;; RESOURCE ACCESS OPERATIONS
-
-
;;; TRANSACTIONS
-
-
(defun new-user (&key name)
(with-transaction ()
(make-instance 'user :name name)))
-
-
-
-
;;; CLIENT
(defparameter +user-key+ "vampire.userkey")
@@ -88,18 +78,9 @@
(setf (url (location (connection-body parent)))
url)))))))
-(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-form (parent playlist &rest args)