From 683d7e88e46463497033eb4759ced45ee8b8cc49 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 14 Dec 2013 19:50:00 +0100 Subject: Allow some options taking filenames to refer to mpv config dir Add the mp_get_user_path() function, and make it expand special path prefixes. Use it for some things in mpv which take filenames (--input-config, --screenshot-template, opengl icc-profile suboption). This allows accessing files in the mpv config dir without hardcoding the config path by prefixing the path with ~~/. Details see manpage additions. --- DOCS/man/en/mpv.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'DOCS') diff --git a/DOCS/man/en/mpv.rst b/DOCS/man/en/mpv.rst index 44a0c36f80..003a36ed53 100644 --- a/DOCS/man/en/mpv.rst +++ b/DOCS/man/en/mpv.rst @@ -285,6 +285,28 @@ It has the following format:: ``mpv --ao=pcm:file=%`expr length "$NAME"`%"$NAME" test.avi`` +Paths +----- + +Some care must be taken when passing arbitrary paths and filenames to mpv. For +example, paths starting with ``-`` will be interpreted as options. Likewise, +if a path contains the sequence ``://``, the string before that might be +interpreted as protocol prefix, even though ``://`` can be part of a legal +UNIX path. To avoid problems with arbitrary paths, you should be sure that +absolute paths passed to mpv start with ``/``, and relative paths with ``./``. + +The name ``-`` itself is interpreted as stdin, and will cause mpv to disable +console controls. (Which makes it suitable for playing data piped to stdin.) + +For paths passed to suboptions, the situation is further complicated by the +need to escape special characters. To work this around, the path can be +additionally wrapped in the ``%n%string_of_length_n`` syntax (see above). + +Some mpv options interpret paths starting with ``~``. Currently, the prefix +``~~/`` expands to the mpv configuration directory (usually ``~/.mpv/``). +``~/`` expands to the user's home directory. (The trailing ``/`` is always +required.) + Per-File Options ---------------- -- cgit v1.2.3