diff --git a/anime/__main__.py b/anime/__main__.py index 44db6feb6359c5c2ccf7113f2274f34bc167875f..c86f2e5aef0b274b13136ffd5f17c61307569449 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 68c0a96014c6d4b400e4c958fa092c77482d7d2e..ff330ed1c64323d276cb9a23c8ad1c94f2af450a 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 6bad3d5f68b282d89adda8787e0e5f990ce03a77..29008c619c07bf9eb9e6c452cbf3288e077c282e 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 3d41ff4aed3a24f90d37bff6fc92baa81cfe7afa..9406048eed49b9019297a8b8178c824c1d0af0ff 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"]