diff options
-rw-r--r-- | downloader.lisp | 23 | ||||
-rw-r--r-- | vampire.asd | 4 |
2 files changed, 26 insertions, 1 deletions
diff --git a/downloader.lisp b/downloader.lisp index e9b8ffb..043fbe7 100644 --- a/downloader.lisp +++ b/downloader.lisp @@ -78,3 +78,26 @@ media-dir))) (uiop:copy-file downloaded file) (new-track file info))))) + +;; TODO: handle servers that don't respond to HEAD +(defun url-content-type (url) + (multiple-value-bind (body status headers) (drakma:http-request url :method :head) + (drakma:header-value :content-type headers))) + +(defun audio-url-p (url) + (equal "audio" (first (cl-ppcre:split "/" (url-content-type url))))) + +(defun audio-filename (url) + (quri:url-decode (first (last (cl-ppcre:split "/" url))))) + +(defun audio-file-trackinfo (url) + (let* ((filename (audio-filename url)))) + (with-plist ((url :|url|)) (first thumbs) + (list + :source source + :title (or track-title title) + :album album + :codec codec + :artist artist + :duration dur + :thumb-url url))) diff --git a/vampire.asd b/vampire.asd index 9014aa8..962c020 100644 --- a/vampire.asd +++ b/vampire.asd @@ -13,9 +13,11 @@ #:legion #:defclass-std #:derrida + #:drakma #:ironclad #:jonathan - #:swank + #:quri + #:swank #:zippy) :components ((:file "hunchentoot-handle-static-file") (:file "package") |