aboutsummaryrefslogtreecommitdiffstats
path: root/yeetube.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-08-18 10:25:50 +0300
committerThanos Apollo <[email protected]>2023-08-18 10:25:50 +0300
commit06f2fc5c0c1db61c56f4bbe65a21d8be912bb860 (patch)
treeb9f5dd0083b0a9d0d7048488e157e21c3d97aa49 /yeetube.el
parenta9238f1fd3ce26f0e641b4621fcd6b2806d56d33 (diff)
redo yeetube-send-command-to-socket
Simplify network-process
Diffstat (limited to 'yeetube.el')
-rw-r--r--yeetube.el21
1 files changed, 6 insertions, 15 deletions
diff --git a/yeetube.el b/yeetube.el
index 8d3101e..854a990 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -214,8 +214,6 @@ It's recommended you keep it as the default value."
(when clear-saved
(setq yeetube-saved-videos nil))))
-;; MPV STUFF
-
(defun yeetube-disable-video-mpv ()
"Toggle video on/off for mpv player."
(interactive)
@@ -228,20 +226,13 @@ It's recommended you keep it as the default value."
(concat mpv no-video socket)))
(message (format "Yeetube Player: %s" yeetube-player))))
-(defun yeetube-send-command-to-socket (socket-file json-data)
- "Send command with JSON-DATA to SOCKET-FILE."
- (let* ((proc-name "mpv-socket")
- (proc-buffer (generate-new-buffer proc-name))
- (proc (make-network-process :name proc-name
+(defun yeetube-send-command-to-socket (socket json-data)
+ "Send command with JSON-DATA to SOCKET."
+ (let* ((proc (make-network-process :name "yeet-socket"
:family 'local
- :buffer proc-buffer
- :service socket-file)))
- (let ((json-string (concat json-data "\n")))
- (process-send-string proc json-string))
- (accept-process-output proc)
- (sit-for 0.1) ; wait for the process to finish
- (with-current-buffer proc-buffer
- (buffer-string))))
+ :service socket)))
+ (process-send-string proc (concat json-data "\n"))
+ (accept-process-output proc)))
(defun yeetube--send-command (property value)
"Send command with PROPERTY and VALUE as json-data to mpv socket."