+# Must be called from beetag for variables to be setup
+beetag-nostatus() {
+ if (( $# )); then
+ scrolled=$(( scrolled + $1 ))
+ fi
+ if $erasable_line; then
+ # https://stackoverflow.com/a/71286261
+ printf '\033[1A\033[K'
+ fi
+ erasable_line=false
+}
+# meant to be called from beetag
+beetag-status() {
+ if $erasable_line; then
+ # https://stackoverflow.com/a/71286261
+ printf '\033[1A\033[K'
+ fi
+ erasable_line=true
+}
+
+# meant to be called from beetag
+mpvrpc() {
+ if jobs -p | grep -q . &>/dev/null; then
+ printf "%s\n" "$*" | socat - /tmp/mpvsock >/dev/null ||:
+ fi
+}
+# meant to be called from beetag
+# o for get output
+mpvrpco() {
+ # note: testing for background jobs will output nothing if we are in a pipeline
+ printf "%s\n" "$*" | socat - /tmp/mpvsock ||:
+}
+
+# meant to be called from beetag
+mpvrpc-percent-pos() {
+ mpvrpco '{ "command": ["get_property", "percent-pos"] }' | jq .data | sed 's/\..*/%/' 2>/dev/null ||:
+}
+