aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-10-30 08:24:15 -0500
committerColin Okay <colin@cicadas.surf>2022-10-30 08:24:15 -0500
commit6ddf222b87c61f0977c6a0becf32c5cb883ed710 (patch)
tree1592879942a7bf86f38e1387e409484fdbc034fb
parente82f24fdb36a65e890264b67c196d0a55068b241 (diff)
Tweak: dispaly tweak, truncating track titles to 30 chars
-rw-r--r--package.lisp3
-rw-r--r--playlist.lisp21
2 files changed, 13 insertions, 11 deletions
diff --git a/package.lisp b/package.lisp
index 623e166..ded3da3 100644
--- a/package.lisp
+++ b/package.lisp
@@ -18,5 +18,6 @@
#:with-gensyms
#:when-let
#:when-let*
- #:if-let)
+ #:if-let
+ #:subseq*)
(:import-from #:defclass-std #:defclass/std))
diff --git a/playlist.lisp b/playlist.lisp
index 0fe1ae9..27deada 100644
--- a/playlist.lisp
+++ b/playlist.lisp
@@ -119,10 +119,7 @@
(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)) (if (track-artist tr)
- (format nil "~a" (track-artist tr))
- "")
+ (setf (text (np-title ctl)) (track-listing-line tr nil)
(url-src (np-thumb ctl)) (or (track-thumb-url tr) "")
(text (np-dur ctl)) (secs-to-hms (or (track-duration tr) 0))
(text (np-time ctl)) (secs-to-hms 0))))
@@ -233,7 +230,6 @@
(img (:bind thumb))
(section (:h4)
(span (:bind title))
- (span (:content " | "))
(span (:bind artist)))
(p ()
(span (:bind time))
@@ -258,12 +254,17 @@
(pathname-name (track-file track))
(pathname-type (track-file track))))
-(defun track-listing-line (track)
+(defun track-listing-line (track &optional (timep t))
(with-slots (artist title duration) track
- (format nil "~50<~a~;~a~;~a~>"
- title
- (if artist (concatenate 'string "by " artist) "")
- (secs-to-hms (or duration 0)))))
+ (if timep
+ (format nil "~50<~a~;~a~;~a~>"
+ (subseq* title 0 30)
+ (if artist (concatenate 'string "by "
+ artist) "")
+ (secs-to-hms (or duration 0)))
+ (format nil "~45<~a~;~a~>"
+ (subseq* title 0 30)
+ (if artist (concatenate 'string "by " artist) "")))))
(defun create-track-list-item (list track ctl)
(with-clog-create list