cl-mpd-runner/runner.lisp
2024-09-28 14:52:50 -04:00

38 lines
1.6 KiB
Common Lisp

(in-package #:cl-user)
(defpackage #:cl-mpd-runner
(:use #:cl)
(:export #:main))
(in-package #:cl-mpd-runner)
(load #P"test-client.lisp")
(defun content-type (type)
(format t "Content-Type:~a~%~%" type))
(defun setup-mpd-environment (&key (host "localhost") (port "6600"))
(setf (uiop:getenv "MPD_HOST") host
(uiop:getenv "MPD_PORT") port))
;; Excuse the mess.
(defun html-header ()
(format t "<!DOCTYPE html>
<html lang='en'><head><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1'><link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/bulma/1.0.2/css/bulma.min.css' integrity='sha512-RpeJZX3aH5oZN3U3JhE7Sd+HG8XQsqmP3clIbu4G28p668yNsRNj3zMASKe1ATjl/W80wuEtCx2dFA8xaebG5w==' crossorigin='anonymous' referrerpolicy='no-referrer'><script src='https://cdnjs.cloudflare.com/ajax/libs/anchor-js/5.0.0/anchor.min.js' integrity='sha512-byAcNWVEzFfu+tZItctr+WIMUJvpzT2kokkqcBq+VsrM3OrC5Aj9E2gh+hHpU0XNA3wDmX4sDbV5/nkhvTrj4w==' crossorigin='anonymous' referrerpolicy='no-referrer'></script>
<title>Now Playing - MPD Status</title>
</head><body><section class='section'><div class='container'><div class='content'>"))
(defun html-footer ()
(format t "</div></div></section></body></html>"))
(defun main ()
(setup-mpd-environment :host "10.99.99.2")
(content-type "text/html; charset=utf-8")
(html-header)
(mpd::clos-client)
(html-footer))
;; (format t "~{~a~^~%~}~%" (sb-ext:posix-environ)))
;; (format t "~a~%" (probe-file "/var/www/html/cgi/cl-mpd/"))
;; (format t "~a~%" asdf:*central-registry*)
;; (format t "~a" (sb-unix::posix-getenv "HTTP_USER_AGENT")))