From: Christophe Rhodes Date: Sun, 7 Dec 2014 20:41:44 +0000 (+0000) Subject: player commands X-Git-Url: http://christophe.rhodes.io/gitweb/?a=commitdiff_plain;h=5cffc455955e6d64450aae8ba447ab83d9e5a6ac;p=squeeze-el.git player commands just enough to do next and previous track, and to specify which player should be operated on --- diff --git a/squeeze.el b/squeeze.el index 16fdb83..ee21ded 100644 --- a/squeeze.el +++ b/squeeze.el @@ -47,8 +47,28 @@ (define-key map (kbd "+") 'squeeze-control-volume-up) (define-key map (kbd "-") 'squeeze-control-volume-down) (define-key map (kbd "t") 'squeeze-control-toggle-syncgroup-display) + (define-key map (kbd ">") 'squeeze-control-next-track) + (define-key map (kbd "<") 'squeeze-control-previous-track) + (define-key map (kbd "s") 'squeeze-control-select-player) map)) +(defvar squeeze-control-current-player nil) + +(defun squeeze-control-select-player (id) + (interactive + (list (or (get-text-property (point) 'squeeze-playerid) + (let ((name (completing-read "Select player: " (mapcar 'squeeze-player-name squeeze-players)))) + (squeeze-player-playerid (squeeze-find-player-from-name name)))))) + (setq squeeze-control-current-player id)) + +(defun squeeze-control-next-track () + (interactive) + (squeeze-send-string "%s playlist index +1" squeeze-control-current-player)) + +(defun squeeze-control-previous-track () + (interactive) + (squeeze-send-string "%s playlist index -1" squeeze-control-current-player)) + (define-derived-mode squeeze-control-mode special-mode "SqueezeControl" "Major mode for controlling Squeezebox Servers.\\")