Dolda2000 GitWeb
/
lisp-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
9d561d5
)
Made mpcl:connect more standardized.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Tue, 5 Jan 2010 05:31:32 +0000
(06:31 +0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Tue, 5 Jan 2010 05:31:32 +0000
(06:31 +0100)
mpcl.lisp
patch
|
blob
|
blame
|
history
diff --git
a/mpcl.lisp
b/mpcl.lisp
index
4cc6656
..
98a545e
100644
(file)
--- a/
mpcl.lisp
+++ b/
mpcl.lisp
@@
-192,7
+192,19
@@
:message "Invalid response from mpd: ~A"
:inputs (list line))))))))
:message "Invalid response from mpd: ~A"
:inputs (list line))))))))
-(defun connect (&key (host "localhost") (port 6600))
+(defun default-host ()
+ (block nil
+ #+sbcl (let ((host (sb-posix:getenv "MPD_HOST")))
+ (when host (return host)))
+ "localhost"))
+
+(defun default-port ()
+ (block nil
+ #+sbcl (let ((port (sb-posix:getenv "MPD_PORT")))
+ (when port (return (parse-integer port))))
+ 6600))
+
+(defun connect (&key (host (default-host)) (port (default-port)))
"Connect to a running MPD."
(disconnect)
(with-conn-lock
"Connect to a running MPD."
(disconnect)
(with-conn-lock