Mercurial > libervia-backend
view doc/libervia-cli/input.rst @ 4240:79c8a70e1813
backend, frontend: prepare remote control:
This is a series of changes necessary to prepare the implementation of remote control
feature:
- XEP-0166: add a `priority` attribute to `ApplicationData`: this is needed when several
applications are working in a same session, to know which one must be handled first.
Will be used to make Remote Control have precedence over Call content.
- XEP-0166: `_call_plugins` is now async and is not used with `DeferredList` anymore: the
benefit to have methods called in parallels is very low, and it cause a lot of trouble
as we can't predict order. Methods are now called sequentially so workflow can be
predicted.
- XEP-0167: fix `senders` XMPP attribute <=> SDP mapping
- XEP-0234: preflight acceptance key is now `pre-accepted` instead of `file-accepted`, so
the same key can be used with other jingle applications.
- XEP-0167, XEP-0343: move some method to XEP-0167
- XEP-0353: use new `priority` feature to call preflight methods of applications according
to it.
- frontend (webrtc): refactor the sources/sink handling with a more flexible mechanism
based on Pydantic models. It is now possible to have has many Data Channel as necessary,
to have them in addition to A/V streams, to specify manually GStreamer sources and
sinks, etc.
- frontend (webrtc): rework of the pipeline to reduce latency.
- frontend: new `portal_desktop` method. Screenshare portal handling has been moved there,
and RemoteDesktop portal has been added.
- frontend (webrtc): fix `extract_ufrag_pwd` method.
rel 436
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 11 May 2024 13:52:41 +0200 |
parents | c80a0f864b5d |
children |
line wrap: on
line source
================================================ input: automatise commands using external inputs ================================================ ``input`` is a way to use external data (like file in a specific format) as input arguments. It may be seen as a something similar to ``--output`` but for inputs. csv === CSV (for Comma-Separated Values) is a common format for tabular data. It is widely used in spreadsheet software (at least at en export format). With ``csv`` command, you can use columns a CSV file as arguments to li commands. To set the command, you'll write in sequence what to do with each column of your data. For each column you can: - specify a short option name using ``-s ARGUMENTS, --short ARGUMENTS`` (short options are the ones with a single ``-``) - specify a long option name using ``-l ARGUMENTS, --long ARGUMENTS`` (long options are the ones with two ``-``) - specify a positional argument using ``-p ARGUMENTS, --positional ARGUMENTS`` - indicate to use the column data with ``stdin`` using ``-i, --stdin`` - ignore the column if it's not used in the li command, using ``-x, --ignore`` After each column specification, you may use a filter to manage the value. So far the following filters are available: ``-S, --split`` This will split the value (on any whitespace character, discarding empty values) and repeat the option which each item. This is useful when you are using an option which can be repeated (like ``-t TAG, --tag TAG`` with ``li blog set``). ``-E ARGUMENTS, --empty ARGUMENTS`` Indicate what to do if the column value is empty (by default en empty string is used). You can use either ``skip`` to skip the whole row, or ``ignore`` so the option will not be set at all (which is different from the default which will still set the option but with an empty string). CSV file is read from stdin, and by default unicode is expected. You may force an encoding by using ``--encoding ENCODING``. By default all the rows are read, but you may want to ignore first rows (if they are used for columns title, or if you have already handled part of the list). To do that, use the ``-r ROW, --row ROW`` option. When you test your command, it is better to do a dry run to see what will happen. The ``-D, --debug`` option is here for that: if you set it, the commands won't be actually run, but the exact command which would be executed will be printed on screen. You should always use this option first until you're sure that what you want will be executed. You may add verbosity level to help debugging. With a verbosity level of 2 (i.e. ``-vv``) the value read from CSV will be printed. By default stdout and stderr of each launched command is ignored, but you can log them to files using respectively ``--log LOG`` and ``--log-err LOG_ERR`` where ``LOG`` and ``LOG_ERR`` are paths to a log file to create. Once all the sequence and options are set, you write the li command that you want to use, with all the needed static option (i.e. options which must be used each time). example ------- Louise as a spreadsheet with a table like this: ============================ ============ ============= =============== title body internal data tags ============================ ============ ============= =============== Some title a body ABC li demo Something else another body XYZ li demo Third one third body VWZ special_tag li This one doesn't have a body 123 li demo numbers last one last body 456 li demo numbers ============================ ============ ============= =============== She wants to use it as input data to create blog posts. She first saves the file using CSV format, let's say to ``~/blog_input.csv``. Then she checks ``li blog set --help`` to get name of options to use. She'll need to use ``--title`` for title, ``stdin`` for the body and ``-t`` for tags. Louise wants to activate comments, so she also wants to use ``-C`` for all posts, and a tag to says it's coming from the spreadsheet (using ``-t spreadsheet``) . The first row of the table is used for columns headers, so she'll start at row 1 with ``-r 1``. There is one row without body, Louise want to skip any row without body so she'll use the ``-E skip`` filter, just after specifying the body row. Reading column by column, the sequence is like this: ``-l title`` a title which goes to the ``--title`` long option of ``li blog`` ``-i -E skip`` a body which goes to the stdin of ``li blog``. If the body is empty, the ``-E skip`` filter tells to skip the whole row. ``-x`` the ``internal data`` column is not used, so it is ignored ``-s t -S`` the last column are the tags, so the ``-t`` short option is used. There are several of them separated by spaces, so the ``-S`` filter is used to split the values. First she'll use the ``-D, --debug`` to check that the commands which will be executed are the expected one:: $ li input csv -D -r 1 -l title -i -E skip -x -s t -S blog set -C -t spreadsheet < ~/blog_input.csv Everything seems fine, so she'll actually launch the command by running the same command line but without the ``-D`` option:: $ li input csv -r 1 -l title -i -E skip -x -s t -S blog set -C -t spreadsheet < ~/blog_input.csv She could also have used ``--log`` and ``--log-err`` to check the logs of each command:: $ li input csv -r 1 -l title -i -E skip -x -s t -S --log /tmp/jp_blog_stdout.log --log-err /tmp/jp_blog_stderr.log blog set -C -t spreadsheet < ~/blog_input.csv