Fixed build.

Signed-off-by: Pavel Kirilin <win10@list.ru>
This commit is contained in:
2024-05-02 02:29:19 +02:00
parent c0b319e79d
commit 08c44219b0
4 changed files with 10 additions and 6 deletions

View File

@ -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():

View File

@ -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({})

View File

@ -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>

View File

@ -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"]