The receiving part was implemented, but since no messages are enabled by default, it couldn't be used.
Unified · Split
| @@ -146,6 +146,16 @@ extra commands can also be used as part of the protocol: · 145 unmodified lines | ||
| 146 | 146 | { "command": ["unobserve_property", 1] } |
| 147 | 147 | { "error": "success" } |
| 148 | 148 | |
| 149 | +``request_log_messages`` | |
| 150 | + Enable output of mpv log messages. They will be received as events. The | |
| 151 | + parameter to this command is the log-level (see ``mpv_request_log_messages`` | |
| 152 | + C API function). | |
| 153 | + | |
| 154 | + Log message output is meant for humans only (mostly for debugging). | |
| 155 | + Attempting to retrieve information by parsing these messages will just | |
| 156 | + lead to breakages with future mpv releases. Instead, make a feature request, | |
| 157 | + and ask for a proper event that returns the information you need. | |
| 158 | + | |
| 149 | 159 | ``suspend`` |
| 150 | 160 | Suspend the mpv main loop. There is a long-winded explanation of this in |
| 151 | 161 | the C API function ``mpv_suspend()``. In short, this prevents the player |
| @@ -414,6 +414,19 @@ static char *json_execute_command(struct client_arg *arg, void *ta_parent, · 413 unmodified lines | ||
| 414 | 414 | |
| 415 | 415 | rc = mpv_unobserve_property(arg->client, |
| 416 | 416 | cmd_node->u.list->values[1].u.int64); |
| 417 | + } else if (!strcmp("request_log_messages", cmd)) { | |
| 418 | + if (cmd_node->u.list->num != 2) { | |
| 419 | + rc = MPV_ERROR_INVALID_PARAMETER; | |
| 420 | + goto error; | |
| 421 | + } | |
| 422 | + | |
| 423 | + if (cmd_node->u.list->values[1].format != MPV_FORMAT_STRING) { | |
| 424 | + rc = MPV_ERROR_INVALID_PARAMETER; | |
| 425 | + goto error; | |
| 426 | + } | |
| 427 | + | |
| 428 | + rc = mpv_request_log_messages(arg->client, | |
| 429 | + cmd_node->u.list->values[1].u.string); | |
| 417 | 430 | } else if (!strcmp("suspend", cmd)) { |
| 418 | 431 | if (arg->suspend_counter < INT_MAX) { |
| 419 | 432 | mpv_suspend(arg->client); |