>From 694be0f3bef99b7c8571a50441075a57e8a823cf Mon Sep 17 00:00:00 2001 From: Morgan Veyret Date: Tue, 12 Aug 2008 13:07:45 +0200 Subject: [PATCH] Fixed timeout problem. This adds a timer and a new var *MPD-TIMEOUT*. When set to nil the timer is disabled. The value of *MPD-TIMEOUT* should be something under the real mpd server timeout value so the client will ping mpd every *mpd-timeout* seconds. --- contrib/mpd.lisp | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/contrib/mpd.lisp b/contrib/mpd.lisp index 991b900..1d2572f 100644 --- a/contrib/mpd.lisp +++ b/contrib/mpd.lisp @@ -47,6 +47,12 @@ ) (defparameter *mpd-port* 6600) +(defvar *mpd-timeout* 50) + +(defparameter *mpd-timer* + (when *mpd-timeout* + (run-with-timer *mpd-timeout* *mpd-timeout* 'mpd-ping))) + (defvar *mpd-collapse-album-length* nil) (defvar *mpd-collapse-all-length* nil) @@ -135,6 +141,9 @@ (close *mpd-socket*) (setf *mpd-socket* nil))) +(defun mpd-ping () + (mpd-send-command "ping")) + (defun mpd-search (type what &optional (exact-search nil)) (mpd-format-command "~a ~a \"~a\"" (if exact-search "find" @@ -260,6 +269,8 @@ (song-number (position choice result))) (mpd-send-command (format nil "play ~d" song-number))))))) +(defcommand-alias select-song-from-playlist browse-playlist) + (defcommand mpd-browse-albums () () (labels ((pick (options) (let ((selection -- 1.5.5.1