summaryrefslogtreecommitdiffstats
path: root/DOCS
diff options
context:
space:
mode:
authorChrisK2 <spam@kalania.de>2014-05-23 13:24:27 +0200
committerChrisK2 <spam@kalania.de>2014-05-23 13:24:27 +0200
commitce69afab440b108972810663255e9211972e964b (patch)
tree2c6345ba2d0e0523e264bfbe8b313cfc19eaa13a /DOCS
parentc6915d732510812098e6e6c5f4d3d7e28fe21429 (diff)
downloadmpv-ce69afab440b108972810663255e9211972e964b.tar.bz2
mpv-ce69afab440b108972810663255e9211972e964b.tar.xz
lua/osc: forgot some changed files in previous commit
Diffstat (limited to 'DOCS')
-rw-r--r--DOCS/man/en/lua.rst55
-rw-r--r--DOCS/man/en/osc.rst59
2 files changed, 94 insertions, 20 deletions
diff --git a/DOCS/man/en/lua.rst b/DOCS/man/en/lua.rst
index 0365fd7a02..ab5a70ef57 100644
--- a/DOCS/man/en/lua.rst
+++ b/DOCS/man/en/lua.rst
@@ -188,8 +188,8 @@ The ``mp`` module is preloaded, although it can be loaded manually with
This will print the message ``the key was pressed`` when ``x`` was pressed.
- The user can remap these key bindings. Then the user has to put the following
- into his input.conf to remap the command to the ``y`` key:
+ The user can remap these key bindings. Then the user has to put the
+ following into his input.conf to remap the command to the ``y`` key:
::
@@ -411,6 +411,57 @@ with ``require 'mp.msg'``.
All of these are shortcuts and equivalent to the corresponding
``msg.log(level, ...)`` call.
+mp.option
+---------
+
+mpv comes with a built-in module to manage options from config-files and the
+command-line. All you have to do is to supply a table with default options to
+the read_options function. The function will overwrite the default values
+with values found in the config-file and the command-line (in that order).
+
+``read_options(table, identifier)``
+ A ``table`` with key-value pairs. The type of the default values is
+ important for converting the values read from the config file or
+ command-line back. Do not use ``nil`` as a default value!
+
+ The ``identifier`` is used to identify the config-file and the command-line
+ options. These needs to unique to avoid collisions with other scripts.
+ Defaults to ``mp.get_script_name()``.
+
+
+Example implementation::
+
+ local opt = require 'mp.options'
+ local options = {
+ optionA = "defaultvalueA",
+ optionB = -0.5,
+ optionC = true,
+ }
+ read_options(options, "myscript")
+ print(option.optionA)
+
+
+The config file will be stored in ``lua-settings/identifier.conf`` in mpv's user
+folder. Comment lines can be started with # and stray spaces are not removed.
+Boolean values will be represented with yes/no.
+
+Example config::
+
+ # comment
+ optionA=Hello World
+ optionB=9999
+ optionC=no
+
+
+Command-line options are read from the ``--lua-opts`` parameter. To avoid
+collisions, all keys have to be prefixed with ``identifier-``.
+
+Example command-line::
+
+ --lua-opts=myscript-optionA=TEST:myscript-optionB=0:myscript-optionC=yes
+
+
+
Events
------
diff --git a/DOCS/man/en/osc.rst b/DOCS/man/en/osc.rst
index dab98bd2fc..2df6ff6feb 100644
--- a/DOCS/man/en/osc.rst
+++ b/DOCS/man/en/osc.rst
@@ -122,18 +122,24 @@ time remaining
left-click toggle between total and remaining time
============= ================================================
-hide
- | Hide the OSC permanently until mpv is restarted.
+Keybindings
+~~~~~~~~~~~
- ============= ================================================
- del hide the OSC
- ============= ================================================
+These keybindings are active by default if nothing else is already bound to
+these keys. In case of collosision, the function needs to be bound to a
+different key. See `Script Commands`_ section.
+
+============= ================================================
+del Hide the OSC permanently until mpv is restarted.
+============= ================================================
Configuration
-------------
-The OSC offers limited configuration through a config file ``plugin_osc.conf``
-placed in mpv's user dir.
+The OSC offers limited configuration through a config file
+``lua-settings/osc.conf`` placed in mpv's user dir and through the
+``--lua-opts`` command-line option. Options provided through the command-line
+will override those from the config file.
Config Syntax
~~~~~~~~~~~~~
@@ -141,14 +147,25 @@ Config Syntax
The config file must exactly follow the following syntax::
# this is a comment
- parameter1=value1
- parameter2=value2
+ optionA=value1
+ optionB=value2
``#`` can only be used at the beginning of a line and there may be no
spaces around the ``=`` or anywhere else.
-Configurable parameters
-~~~~~~~~~~~~~~~~~~~~~~~
+Command-line Syntax
+~~~~~~~~~~~~~~~~~~~
+
+To avoid collisions with other scripts, all options need to be prefixed with
+``osc-``.
+
+Example::
+
+ --lua-opts=osc-optionA=value1:osc-optionB=value2
+
+
+Configurable Options
+~~~~~~~~~~~~~~~~~~~~
``showwindowed``
| Default: yes
@@ -199,14 +216,20 @@ Configurable parameters
| Default: 0
| Size of the deadzone. The deadzone is an area that makes the mouse act
like leaving the window. Movement there won't make the OSC show up and
- it will hide immediately if the mouse enters it.
+ it will hide immediately if the mouse enters it. The deadzone starts
+ at the window border opposite to the OSC and the size controls how much
+ of the window it will span. Values between 0 and 1.
``minmousemove``
| Default: 3
| Minimum amount of pixels the mouse has to move between ticks to make
the OSC show up
-Script commands
+``seektooltip``
+ | Default: yes
+ | Display a tooltip over the seekbar indicating time at mouse position.
+
+Script Commands
~~~~~~~~~~~~~~~
The OSC script listens to certain script commands. These commands can bound
@@ -219,11 +242,11 @@ in ``input.conf``, or sent by other scripts.
Hide the OSC permanently. This is also what the ``del`` key does.
-.. admonition:: Example
+Example
- You could out this into ``input.conf`` to hide the OSC with the ``a`` key
- and to unhide it with ``b``:
+You could put this into ``input.conf`` to hide the OSC with the ``a`` key and
+to unhide it with ``b``::
- | a script_message disable-osc
- | b script_message enable-osc
+ a script_message disable-osc
+ b script_message enable-osc