player: fix use of mpv pipe

There may be more than one event queued, so call the dispatch function
recursively until MPV_EVENT_NONE is returned. The previous behaviour was missing
a lot of events apparently but I didn't notice.

Also, the pipe may contain more than one byte, so flush it accordingly. The
flushing is done only once in the "check" callback, instead of doing it every
time before mpv_wait_event().
player: remove trailing newline from mpv logs

This is a bit of an ugly hack, and is still broken in the case of multiline logs
messages, or in the case of partial lines.
player: better termination of the player

Use the appropriate API instead of sending a quit command and destroying the
context manually. The previous behaviour was probably broken since we didn't
wait for the MPV_EVENT_SHUTDOWN after sending the command.
player: initialize mpv after attaching the main loop source

This way we properly receive all the initialization events (pretty much only log
messages).