branch: elpa/mpv
commit 9e1781249fc362e1f095e4773dca25a840e4b7e2
Author: Johann Klähn <[email protected]>
Commit: Johann Klähn <[email protected]>
convert numbers to strings before encoding as JSON
Seems like mpv wants "command" to be a list of strings.
---
mpv.el | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/mpv.el b/mpv.el
index 6b2c972db3..dbabfba262 100644
--- a/mpv.el
+++ b/mpv.el
@@ -119,6 +119,14 @@ prepended to ARGS."
(run-hook-with-args 'mpv-on-start-hook args)
t))
+(defun -as-strings (command)
+ "Convert COMMAND to a list of strings."
+ (mapcar (lambda (arg)
+ (if (numberp arg)
+ (number-to-string arg)
+ arg))
+ command))
+
(defun -enqueue (command fn &optional delay-command)
"Add COMMAND to the transaction queue.
@@ -133,7 +141,7 @@ below."
(when (live-p)
(tq-enqueue
-queue
- (concat (json-encode `((command . ,command))) "\n")
+ (concat (json-encode `((command . ,(-as-strings command)))) "\n")
"" nil fn delay-command)
t))