ipc: skip empty and commented lines

This commit is contained in:
wm4 2014-10-19 21:43:08 +02:00
parent cf627fd3de
commit d089772b69
2 changed files with 9 additions and 3 deletions

View File

@ -49,7 +49,11 @@ can also be present. See `List of events`_ for a list of all supported events.
If the first character (after skipping whitespace) is not ``{``, the command
will be interpreted as non-JSON text command, as they are used in input.conf
(or ``mpv_command_string()`` in the client API).
(or ``mpv_command_string()`` in the client API). Additionally, line starting
with ``#`` and empty lines are ignored.
Currently, embedded 0 bytes terminate the current line, but you should not
rely on this.
Commands
--------

View File

@ -557,8 +557,10 @@ static void *client_thread(void *p)
json_skip_whitespace(&line0);
char *reply_msg;
if (line0[0] == '{') {
char *reply_msg = NULL;
if (line0[0] == '\0' || line0[0] == '#') {
// skip
} else if (line0[0] == '{') {
reply_msg = json_execute_command(arg, tmp, line0);
} else {
reply_msg = text_execute_command(arg, tmp, line0);