diff --git a/ff2mpv.py b/ff2mpv.py index b0eb4f0..dfd5b8d 100755 --- a/ff2mpv.py +++ b/ff2mpv.py @@ -49,7 +49,11 @@ def get_message(): def send_message(message): - content = json.dumps(message).encode("utf-8") + # https://stackoverflow.com/a/56563264 + # https://docs.python.org/3/library/json.html#basic-usage + # To get the most compact JSON representation, you should specify + # (',', ':') to eliminate whitespace. + content = json.dumps(message, separators=(",", ":")).encode("utf-8") length = struct.pack("@I", len(content)) sys.stdout.buffer.write(length) sys.stdout.buffer.write(content)