diff options
author | wm4 <wm4@nowhere> | 2014-04-29 01:23:44 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-04-29 01:24:21 +0200 |
commit | 1800becf6a3562bbaeb568631ef47c38e613b571 (patch) | |
tree | bca1e2ddb60e4566a0618bf7bf1afdb20704bb1e /TOOLS | |
parent | 6c87b507277c632452f873514bbd80428553d46e (diff) |
TOOLS/umpv: allow passing options
But only via a special environment variable.
Diffstat (limited to 'TOOLS')
-rwxr-xr-x | TOOLS/umpv | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/TOOLS/umpv b/TOOLS/umpv index 300e6334a3..5f867ce5fe 100755 --- a/TOOLS/umpv +++ b/TOOLS/umpv @@ -23,6 +23,11 @@ Note that you can control the mpv instance by writing to the command fifo: echo "cycle fullscreen" > /tmp/umpv-fifo-* +Note: you can supply custom options with the UMPV_OPTIONS environment variable. + The environment variable will be split on whitespace, and each item is + passed as option to mpv _if_ the script starts mpv. If mpv is not started + by the script (i.e. mpv is already running), the options will be ignored. + Warning: The script attempts to make sure the FIFO is safely created (i.e. not world- @@ -46,6 +51,9 @@ files = sys.argv[1:] # make them absolute; also makes them safe against interpretation as options files = [os.path.abspath(f) for f in files] +opts_env = os.getenv("UMPV_OPTIONS") +opts_env = opts_env.split() if opts_env else [] + FIFO = "/tmp/umpv-fifo-" + os.getenv("USER") fifo_fd = -1 @@ -89,5 +97,9 @@ else: raise e os.mkfifo(FIFO, int("0600", 8)) - subprocess.check_call(["mpv", "--really-quiet", "--force-window", - "--input-file=" + FIFO, "--"] + files) + opts = ["mpv", "--really-quiet", "--force-window", "--input-file=" + FIFO] + opts.extend(opts_env) + opts.append("--") + opts.extend(files) + + subprocess.check_call(opts) |