def initialize(voice_command, sentences): voice_command = voice_command.lower() voice_command = remove_useless_words(voice_command) for sentence in sentences: for part in sentence.split("*"): if part in voice_command: voice_command = voice_command.replace(part, "") results = VideosSearch(voice_command, limit=2).result() url = results['result'][1]['link'] #open video open_w(url + "&autoplay=1") #youtube already autoplay ?? """sleep(4) screenWidth, screenHeight = size() click(screenWidth//2,screenHeight//2)""" response = f"j'ai affiché {voice_command} sur mon écran principal." return True, response
def _help(nvim: Nvim, state: State, settings: Settings, args: Sequence[str]) -> None: """ Open help doc """ try: topic, use_web = _parse_args(args) except ArgparseError as e: write(nvim, e, error=True) else: md, uri = _directory(topic) web_d = open_w(uri) if use_web else False if not web_d: for win in list_floatwins(nvim): win_close(nvim, win=win) lines = md.read_text("UTF-8").splitlines() buf = create_buf(nvim, listed=False, scratch=True, wipe=True, nofile=True, noswap=True) buf_set_lines(nvim, buf=buf, lo=0, hi=-1, lines=lines) buf_set_option(nvim, buf=buf, key="modifiable", val=False) buf_set_option(nvim, buf=buf, key="syntax", val="markdown") open_float_win(nvim, margin=0, relsize=0.95, buf=buf, border="rounded")
from argparse import ArgumentParser, Namespace from os import name from pathlib import Path from subprocess import DEVNULL, run from sys import executable, stderr, stdout, version_info from textwrap import dedent from typing import Union from webbrowser import open as open_w from .consts import MIGRATION_URI, REQUIREMENTS, RT_DIR, RT_DIR_XDG, RT_PY, RT_PY_XDG if version_info < (3, 8, 2): msg = "For python < 3.8.2 please install using the branch -- legacy" print(msg, end="", file=stderr) open_w(MIGRATION_URI) exit(1) from typing import Literal def parse_args() -> Namespace: parser = ArgumentParser() sub_parsers = parser.add_subparsers(dest="command", required=True) s_run = sub_parsers.add_parser("run") s_run.add_argument("--socket", required=True) s_run.add_argument("--xdg", action="store_true") s_deps = sub_parsers.add_parser("deps")
async def main() -> int: branch, uri = await _git_uri() clean_uri = _p_uri(uri, branch=branch) open_w(clean_uri) log.info("%s", hr(clean_uri)) return 0