[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/mpv f31cbdb94a 37/50: Add convenience functions to get and
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/mpv f31cbdb94a 37/50: Add convenience functions to get and set properties |
Date: |
Tue, 28 Dec 2021 00:58:43 -0500 (EST) |
branch: elpa/mpv
commit f31cbdb94a928540069221eb2f7f5847ccab96dc
Author: Johann Klähn <johann@jklaehn.de>
Commit: Johann Klähn <johann@jklaehn.de>
Add convenience functions to get and set properties
Closes #2.
---
mpv.el | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/mpv.el b/mpv.el
index ab9ed7d506..d72ed29ee4 100644
--- a/mpv.el
+++ b/mpv.el
@@ -239,13 +239,33 @@ See `mpv-start' if you need to pass further arguments and
(interactive)
(mpv--enqueue '("cycle" "pause") #'ignore))
+(defun mpv-get-property (property)
+ "Return the value of the given PROPERTY."
+ (mpv-run-command "get_property" property))
+
+(defun mpv-set-property (property value)
+ "Set the given PROPERTY to VALUE."
+ (mpv-run-command "set_property" property value))
+
+(defun mpv-cycle-property (property)
+ "Cycle the given PROPERTY."
+ (mpv-run-command "cycle" property))
+
+(defun mpv-get-playback-position ()
+ "Return the current playback position in seconds."
+ (mpv-get-property "playback-time"))
+
+(defun mpv-get-duration ()
+ "Return the estimated total duration of the current file in seconds."
+ (mpv-get-property "duration"))
+
;;;###autoload
(defun mpv-insert-playback-position (&optional arg)
"Insert the current playback position at point.
When called with a non-nil ARG, insert a timer list item like
`org-timer-item'."
(interactive "P")
- (let ((time (mpv-run-command "get_property" "playback-time")))
+ (let ((time (mpv-get-playback-position)))
(funcall
(if arg #'mpv--position-insert-as-org-item #'insert)
(org-timer-secs-to-hms (round time)))))
- [nongnu] elpa/mpv 33ca8987ed 03/50: work around spurious event messages, (continued)
- [nongnu] elpa/mpv 33ca8987ed 03/50: work around spurious event messages, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 6fe510798a 26/50: fix mpv-speed-set, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv fcdca618df 29/50: add badge for MELPA stable, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv d7bb3a7082 40/50: Add sleep and timeout to mpv-kill and mpv-play, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv bc89524528 15/50: use timer formatting from org-timer.el, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv b026ae5bb6 46/50: Merge pull request #19 from c1-g/volume, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 1e666079b8 05/50: skip junk at beginning of buffer, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 8c0933630b 08/50: add seek-to-position-at-point, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 03fe7a536a 24/50: add mpv-on-start-hook and mpv-on-exit-hook, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 3021c55fa5 32/50: Merge pull request #1 from magnusstahre/expand-tilde, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv f31cbdb94a 37/50: Add convenience functions to get and set properties,
ELPA Syncer <=
- [nongnu] elpa/mpv f0f61db3af 47/50: Add COPYING file following GPL, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 4774d52c8c 48/50: Merge pull request #21 from sachac/master, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 604b32d7e6 11/50: add play command, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 15c51ddc5e 10/50: remove dependency on dash library, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 059135de39 28/50: version 0.1.0, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 9e1781249f 27/50: convert numbers to strings before encoding as JSON, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 79e01bf89b 35/50: Remove stale socket files when mpv process is gone, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 4dddd55c5e 41/50: Add mpv-version., ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 2d40c45505 38/50: Add mpv-seek and mpv-revert-seek commands, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv a5c6eed9ac 44/50: Add volume control commands, ELPA Syncer, 2021/12/28