summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-05-31 20:27:27 +0100
committerjao <jao@gnu.org>2021-05-31 20:27:27 +0100
commit08876c776d423cd0d5f651bdc054cb6d48aae7fc (patch)
treee77a2f92fb1e783a91e25f2bdc7d00e9893a319e
parent83d492d36407588707e41098381328e8b1ebe26c (diff)
downloadelibs-08876c776d423cd0d5f651bdc054cb6d48aae7fc.tar.gz
elibs-08876c776d423cd0d5f651bdc054cb6d48aae7fc.tar.bz2
mpc seek
-rw-r--r--init.org3
-rw-r--r--lib/media/jao-mpc.el11
2 files changed, 11 insertions, 3 deletions
diff --git a/init.org b/init.org
index 29e00bc..df1aa7c 100644
--- a/init.org
+++ b/init.org
@@ -2958,6 +2958,9 @@
(jao-mpc-setup)
+ (defun jao-mpc-seek-forward () (interactive) (jao-mpc-seek 10))
+ (defun jao-mpc-seek-backward () (interactive) (jao-mpc-seek -10))
+
(defalias 'jao-player-connect 'jao-mpc-connect)
(defalias 'jao-player-toggle 'jao-mpc-toggle)
(defalias 'jao-player-next 'jao-mpc-next)
diff --git a/lib/media/jao-mpc.el b/lib/media/jao-mpc.el
index 9004920..6531a8d 100644
--- a/lib/media/jao-mpc.el
+++ b/lib/media/jao-mpc.el
@@ -29,7 +29,7 @@
(require 'jao-lyrics)
(defvar jao-mpc--connection nil)
-(defvar-local jao-mpc--local-connecton nil)
+(defvar-local jao-mpc--local-connection nil)
(defvar-local jao-mpc--local-port nil)
(defvar jao-mpc-host "localhost")
@@ -154,6 +154,8 @@
"Mode to display the list of playlist known by mpd."
(read-only-mode -1)
(delete-region (point-min) (point-max))
+ (setq-local jao-mpc--local-connecton jao-mpc--connection
+ jao-mpc--local-port jao-mpc-port)
(insert (shell-command-to-string (format "mpc -p %s playlist" jao-mpc-port)))
(goto-char (point-min))
(display-line-numbers-mode)
@@ -212,6 +214,11 @@
(jao-mpc--send "previous" nil))
;;;###autoload
+(defun jao-mpc-seek (delta)
+ (interactive "nDelta")
+ (jao-mpc--send (format "seekcur %s%s" (if (> delta 0) "+" "") delta) nil))
+
+;;;###autoload
(defun jao-mpc-clear ()
(interactive)
(jao-mpc--send "clear" nil))
@@ -232,8 +239,6 @@
"Show current playlist."
(interactive)
(pop-to-buffer (jao-mpc--playlist-buffer))
- (setq-local jao-mpc--local-connecton jao-mpc--connection
- jao-mpc--local-port jao-mpc-port)
(jao-mpc--playlist-goto-current))
;;;###autoload