]> rhodes.io Git - squeeze-el.git/commitdiff
Christophe Weblog Wiki Code Publications Music
attempt to do the right thing for common cases of unselected players master
authorChristophe Rhodes <csr21@cantab.net>
Fri, 12 Dec 2014 17:29:12 +0000 (17:29 +0000)
committerChristophe Rhodes <csr21@cantab.net>
Fri, 12 Dec 2014 17:29:12 +0000 (17:29 +0000)
squeeze.el

index 1d4a92d7060082422dafc0eec2ec7782635d9f18..3808a20f117ddbd86028122c7061c4a873336453 100644 (file)
     (define-key map (kbd "!") 'squeeze-control-reconnect)
     map))
 
+(defun squeeze-control-current-player ()
+  (or squeeze-control-current-player
+      (if (= (length squeeze-players) 1)
+          (setq squeeze-control-current-player (squeeze-player-playerid (car squeeze-players)))
+        (call-interactively 'squeeze-control-select-player))))
+
 (defvar squeeze-control-current-player nil)
 
 (defun squeeze-control-select-player (id)
 
 (defun squeeze-control-next-track ()
   (interactive)
-  (squeeze-send-string "%s playlist index +1" squeeze-control-current-player))
+  (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))
+  (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>")
 (defun squeeze-albums-load-album ()
   (interactive)
   (squeeze-send-string "%s playlistcontrol cmd:load album_id:%s"
-                       squeeze-control-current-player
+                       (squeeze-control-current-player)
                        (squeeze-album-id (tabulated-list-get-id))))
 
 (provide 'squeeze)