]> rhodes.io Git - squeeze-el.git/commitdiff
Christophe Weblog Wiki Code Publications Music
player commands
authorChristophe Rhodes <csr21@cantab.net>
Sun, 7 Dec 2014 20:41:44 +0000 (20:41 +0000)
committerChristophe Rhodes <csr21@cantab.net>
Sun, 7 Dec 2014 20:41:44 +0000 (20:41 +0000)
just enough to do next and previous track, and to specify which player
should be operated on

squeeze.el

index 16fdb83a37836e6dfe87cef0fc61a5d7a0e4ad09..ee21dedb449333d082482b9a9f65cb5bd48dbff4 100644 (file)
     (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.\\<squeeze-control-mode-map>")