aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMark Oteiza2015-10-15 12:32:59 -0400
committerMark Oteiza2015-10-15 12:32:59 -0400
commit5110c952069e593cb95593f7b3c41d67cb4559d6 (patch)
tree2fcd8690209a9b6b1a57c704499b63052ec0e79e /lisp
parent59def59158f9c5081664253e30362d0061a2a64f (diff)
downloademacs-5110c952069e593cb95593f7b3c41d67cb4559d6.tar.gz
emacs-5110c952069e593cb95593f7b3c41d67cb4559d6.zip
Add commands for controlling MPD modes
* lisp/mpc.el (mpc-cmd-consume, mpc-cmd-random, mpc-cmd-repeat) (mpc-cmd-single): New functions. (mpc-consume, mpc-repeat, mpc-single, mpc-shuffle): New commands. (mpc-mode-menu): Add new commands as menu items.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mpc.el50
1 files changed, 50 insertions, 0 deletions
diff --git a/lisp/mpc.el b/lisp/mpc.el
index 55123ef1d71..8cbea4fbbbf 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -796,6 +796,22 @@ The songs are returned as alists."
796 ;; (setq mpc-queue-back nil mpc-queue nil) 796 ;; (setq mpc-queue-back nil mpc-queue nil)
797 ) 797 )
798 798
799(defun mpc-cmd-consume (&optional arg)
800 "Set consume mode state."
801 (mpc-proc-cmd (list "consume" arg) #'mpc-status-refresh))
802
803(defun mpc-cmd-random (&optional arg)
804 "Set random (shuffle) mode state."
805 (mpc-proc-cmd (list "random" arg) #'mpc-status-refresh))
806
807(defun mpc-cmd-repeat (&optional arg)
808 "Set repeat mode state."
809 (mpc-proc-cmd (list "repeat" arg) #'mpc-status-refresh))
810
811(defun mpc-cmd-single (&optional arg)
812 "Set single mode state."
813 (mpc-proc-cmd (list "single" arg) #'mpc-status-refresh))
814
799(defun mpc-cmd-pause (&optional arg callback) 815(defun mpc-cmd-pause (&optional arg callback)
800 "Pause or resume playback of the queue of songs." 816 "Pause or resume playback of the queue of songs."
801 (let ((cb callback)) 817 (let ((cb callback))
@@ -1121,6 +1137,16 @@ If PLAYLIST is t or nil or missing, use the main playlist."
1121 ["Play/Pause" mpc-toggle-play] 1137 ["Play/Pause" mpc-toggle-play]
1122 ["Next Track" mpc-next] 1138 ["Next Track" mpc-next]
1123 ["Previous Track" mpc-prev] 1139 ["Previous Track" mpc-prev]
1140 "--"
1141 ["Repeat Playlist" mpc-repeat :style toggle
1142 :selected (member '(repeat . "1") mpc-status)]
1143 ["Shuffle Playlist" mpc-shuffle :style toggle
1144 :selected (member '(random . "1") mpc-status)]
1145 ["Repeat Single Track" mpc-single :style toggle
1146 :selected (member '(single . "1") mpc-status)]
1147 ["Consume Mode" mpc-consume :style toggle
1148 :selected (member '(consume . "1") mpc-status)]
1149 "--"
1124 ["Add new browser" mpc-tagbrowser] 1150 ["Add new browser" mpc-tagbrowser]
1125 ["Update DB" mpc-update] 1151 ["Update DB" mpc-update]
1126 ["Quit" mpc-quit])) 1152 ["Quit" mpc-quit]))
@@ -2336,6 +2362,30 @@ This is used so that they can be compared with `eq', which is needed for
2336 (mpc-status-stop) 2362 (mpc-status-stop)
2337 (if proc (delete-process proc)))) 2363 (if proc (delete-process proc))))
2338 2364
2365(defun mpc-consume ()
2366 "Toggle consume mode: removing played songs from the playlist."
2367 (interactive)
2368 (mpc-cmd-consume
2369 (if (string= "0" (cdr (assq 'consume (mpc-cmd-status)))) "1" "0")))
2370
2371(defun mpc-repeat ()
2372 "Toggle repeat mode."
2373 (interactive)
2374 (mpc-cmd-repeat
2375 (if (string= "0" (cdr (assq 'repeat (mpc-cmd-status)))) "1" "0")))
2376
2377(defun mpc-single ()
2378 "Toggle single mode."
2379 (interactive)
2380 (mpc-cmd-single
2381 (if (string= "0" (cdr (assq 'single (mpc-cmd-status)))) "1" "0")))
2382
2383(defun mpc-shuffle ()
2384 "Toggle shuffling of the playlist (random mode)."
2385 (interactive)
2386 (mpc-cmd-random
2387 (if (string= "0" (cdr (assq 'random (mpc-cmd-status)))) "1" "0")))
2388
2339(defun mpc-stop () 2389(defun mpc-stop ()
2340 "Stop playing the current queue of songs." 2390 "Stop playing the current queue of songs."
2341 (interactive) 2391 (interactive)