从Web界面控制计算机

webcon的Python项目详细描述


Preview of webcon.

从一个简单的web界面通过shell命令控制您的计算机。

配置示例:config.yaml

__variables__:
    mpvfifo: ~/.local/share/mpv/fifo
mpv:
    rewind: echo seek -5 > {mpvfifo}
    play/pause: echo cycle pause > {mpvfifo}
    fast forward: echo seek 5 > {mpvfifo}
announcer:
    greet: say hello
    part: say farewell

安装

pip3 install webcon

制表符完成

sudo activate-global-python-argcomplete

如果通过PIP安装,则在自动完成之前,可能需要运行以下命令:

grep 'PYTHON_ARGCOMPLETE_OK' "$(which webcon)" &>/dev/null || sudo sed -i "1a # PYTHON_ARGCOMPLETE_OK" "$(which webcon)"

用法

usage: webcon [-h] [--host HOST] [-p PORT] [config_file]

Control your computer through shell commands from a barebones web interface.

Configuration goes in ~/.config/webcon/config.yaml, or an alternate location
may be provided by command line argument.

Configuration format:

- Throughout the configuration, order of each mapping is taken into account to
  ensure the layout does not deviate from expectations.
- The top level of the configuration is a mapping.
- Variables in the top-level key `__variables__` will be substituted once via
  `str.format` throughout the entire file. This may be used to extract long
  constants, etc.
- Every other top-level key will define a service, and its value shall be a
  mapping of the actions it supports.
- Each action shall define a label/command pair, in the the form of
  `label: command`.

Example configuration:

    __variables__:
        mpvfifo: ~/.local/share/mpv/fifo
    mpv:
        rewind: echo seek -5 > {mpvfifo}
        play/pause: echo cycle pause > {mpvfifo}
        fast forward: echo seek 5 > {mpvfifo}
    announcer:
        greet: say hello
        part: say farewell

Explanation:

- Define `mpvfifo` as a variable holding the location of a mpv fifo.
- Define a service `mpv`.
    - This service exports the actions `rewind`, `play/pause`, and
      `fast forward`. The actions are different echoes to `mpvffo`.
- Define a service `announcer`.
    - This service exports the actions `greet` and `part`. The actions are
    different phrases which will be synthesized through `say`.

positional arguments:
  config_file           The config file to use. Default:
                        /Users/echan/.config/webcon/config.yaml

optional arguments:
  -h, --help            show this help message and exit
  --host HOST           The server host. Default: 0.0.0.0
  -p PORT, --port PORT  The server port. Default: 8080

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java显示ArrayList中的文本   在Android/Java平台上加密共享密钥   java如何解决此错误{无法启动组件[Connector[HTTP/1.18080]]}?   java无法初始化ActionListener中的类。。。请帮忙!   在Java中访问无顶级类的非顶级类的编译器构造   java前向标头变量Spring Boot   java查找JSF资源的路径   通过Android应用程序中的ContentProvider对临时字段进行java查询   JavaSWT中的Resizeble对话框   java为什么将变量声明为int类型需要强制转换流?长类型不需要强制转换   java应用程序主题在预览中显示,但不在手机上显示   java FirebaseRecyclerAdapter未在我的RecyclerView布局中显示数据   javasocket大容量读取返回一个零数组   java JMX数据作为JSON   java您的应用程序已使用来自Google Cloud SDK的最终用户凭据进行身份验证,而translate不支持这些凭据。古格里皮斯。通用域名格式   java ORA02289:序列不存在,但数据库中不存在序列   在Java中如何将对象数组转换为列表?   java如何在eclipse中进行代码格式转换?