Skip to content

Commit

Permalink
mpvc: Update mpvc
Browse files Browse the repository at this point in the history
  • Loading branch information
gmt4 committed Oct 25, 2023
1 parent 74f61e7 commit 56d5b32
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions mpvc
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,10 @@ mpvc_socklist() {
}

mpvc_cmdr_() {
command=$(for i in "$@"; do printf "$q$i$q, "; done)
command=$(for i in "$@"; do printf "$q$i$q, "; done);
echo "{ \"command\": [ $command ] }";
}
mpvc_cmdr() { equiet mpvc_sockcmd_ "$(q='"' mpvc_cmdr_ "$@")"; }

mpvc_ecmdr() {
ret=$(mpvc_cmdr "$@")
case "$ret" in *"success"*) ;; *) echo "$ret"; return 1 ;; esac
Expand Down Expand Up @@ -858,14 +857,8 @@ mpvc_get_version() {
"$MPVC_MPV" --version
}

mpvc_idleloop() {
$MPVC_SOCAT -t0 -,ignoreeof "$MPVC_SOCKET"
}

mpvc_observe_property() {
#mpvc_ecmdr "unobserve_property" 1
q='' mpvc_cmdr_ "\"observe_property\"" 1 "\"$@\"" | mpvc_idleloop
}
mpvc_idleloop() { $MPVC_SOCAT -t0 -,ignoreeof "$MPVC_SOCKET"; }
mpvc_observe_property() { q='' mpvc_cmdr_ '"observe_property_string"' 1 "\"$1\"" | mpvc_idleloop; }

mpvc_delay() { sleep "${1:-0.1}"; }
mpvc_wait() { until [ -n "$(mpvc_get idle-active)" ]; do mpvc_delay "${1:-}"; done; }
Expand Down

0 comments on commit 56d5b32

Please sign in to comment.