mirror of
https://github.com/HiMeditator/auto-caption.git
synced 2026-02-04 12:24:42 +08:00
22 lines
472 B
Python
22 lines
472 B
Python
import sys
|
|
import json
|
|
|
|
def stdout(text: str):
|
|
stdout_cmd("print", text)
|
|
|
|
def stdout_err(text: str):
|
|
stdout_cmd("error", text)
|
|
|
|
def stdout_cmd(command: str, content = ""):
|
|
msg = { "command": command, "content": content }
|
|
sys.stdout.write(json.dumps(msg) + "\n")
|
|
sys.stdout.flush()
|
|
|
|
def stdout_obj(obj):
|
|
sys.stdout.write(json.dumps(obj) + "\n")
|
|
sys.stdout.flush()
|
|
|
|
def stderr(text: str):
|
|
sys.stderr.write(text + "\n")
|
|
sys.stderr.flush()
|