From 08c44219b0d5aee089fa44fc0b691c75f30e5338 Mon Sep 17 00:00:00 2001 From: Pavel Kirilin <win10@list.ru> Date: Thu, 2 May 2024 02:29:19 +0200 Subject: [PATCH] Fixed build. Signed-off-by: Pavel Kirilin <win10@list.ru> --- anime/__main__.py | 4 ++-- pre_build.py => build.py | 7 +++++-- frontend/src/views/HomeView.vue | 2 +- pyproject.toml | 3 ++- 4 files changed, 10 insertions(+), 6 deletions(-) rename pre_build.py => build.py (94%) diff --git a/anime/__main__.py b/anime/__main__.py index 44db6fe..c86f2e5 100644 --- a/anime/__main__.py +++ b/anime/__main__.py @@ -14,7 +14,7 @@ cli = Typer() @cli.command() def run_app( - host: str = "::", + host: str = "0.0.0.0", port: int = 8000, anime_dir: Optional[Path] = Argument(None, help="Directory where anime is stored."), ): @@ -35,7 +35,7 @@ def run_app( ) app.state.anime_dir = anime_dir - uvicorn.run(app, host=host, port=port) + uvicorn.run(app, host=host, port=port, workers=1) def main(): diff --git a/pre_build.py b/build.py similarity index 94% rename from pre_build.py rename to build.py index 68c0a96..ff330ed 100644 --- a/pre_build.py +++ b/build.py @@ -2,6 +2,7 @@ import os from pathlib import Path from shutil import copytree, rmtree + CURRENT_DIR = Path(__file__).parent STATIC_OUTPUT_DIR = CURRENT_DIR / "anime/static" FRONTEND_DIR = CURRENT_DIR / "frontend" @@ -21,7 +22,7 @@ class DirChanger: os.chdir(CURRENT_DIR) -def build(): +def build(setup_kwargs): """ Build frontend and copy it to the static directory. @@ -38,6 +39,8 @@ def build(): rmtree(STATIC_OUTPUT_DIR, ignore_errors=True) copytree(symlinks=True, src=DIST_DIR, dst=STATIC_OUTPUT_DIR) + return setup_kwargs + if __name__ == "__main__": - build() + build({}) diff --git a/frontend/src/views/HomeView.vue b/frontend/src/views/HomeView.vue index 6bad3d5..29008c6 100644 --- a/frontend/src/views/HomeView.vue +++ b/frontend/src/views/HomeView.vue @@ -24,7 +24,7 @@ async function startWatching() { <Space fill direction="vertical" :size="20"> <Button type="warning" round size="large" @click="kill('mpv')">Убить MPV</Button> <Button type="danger" round size="large" @click="kill('awatch', 'mpv')">Убить awatch</Button> - <Button type="primary" round size="large" :disabled="!can_watch">Ðачать потребление анимы</Button> + <Button type="primary" round size="large" :disabled="!can_watch" @click="startWatching">Ðачать потребление анимы</Button> </Space> <PlayerComponent /> </template> diff --git a/pyproject.toml b/pyproject.toml index 3d41ff4..9406048 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ version = "0.1.0" description = "" authors = ["Pavel Kirilin <win10@list.ru>"] readme = "README.md" +include = ["anime/static/**/*"] [tool.poetry.dependencies] python = "^3.11" @@ -16,7 +17,7 @@ anime = "anime.__main__:main" [tool.poetry.build] generate-setup-file = false -script = "pre_build.py" +script = "build.py" [build-system] requires = ["poetry-core"] -- GitLab