Skip to content

Commit

Permalink
Remove twitch clipper, replay parser and ffmpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
BurnySc2 committed Jan 6, 2024
1 parent 06092cc commit d6ec23b
Show file tree
Hide file tree
Showing 19 changed files with 79 additions and 858 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test_fastapi_server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
env:
SUBDIRECTORY: fastapi_server
IMAGENAME: fastapi_server
VERSION_NUMBER: 1.0.0
VERSION_NUMBER: 1.1.0

jobs:
test_backend:
Expand All @@ -24,7 +24,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}

steps:
Expand Down
10 changes: 5 additions & 5 deletions fastapi_server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM python:3.11-slim

# Install ffmpeg
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qq update \
&& apt-get -qq install --no-install-recommends \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# RUN export DEBIAN_FRONTEND=noninteractive \
# && apt-get -qq update \
# && apt-get -qq install --no-install-recommends \
# ffmpeg \
# && rm -rf /var/lib/apt/lists/*

RUN pip install --no-cache-dir poetry==1.5.1 \
&& yes | poetry cache clear PyPI --all
Expand Down
10 changes: 7 additions & 3 deletions fastapi_server/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ start-dev:

install-dev:
# Required for video conversion
RUN apt -y update && \
apt install -y --no-install-recommends ffmpeg
RUN pip install poetry --no-cache-dir
# RUN export DEBIAN_FRONTEND=noninteractive \
# && apt-get -qq update \
# && apt-get -qq install --no-install-recommends \
# ffmpeg \
# && rm -rf /var/lib/apt/lists/*
RUN pip install --no-cache-dir poetry==1.5.1 \
&& yes | poetry cache clear PyPI --all
COPY poetry.lock pyproject.toml ./
RUN poetry install
COPY . /root/fastapi_server
Expand Down
2 changes: 2 additions & 0 deletions fastapi_server/helper/jinja_renderer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import overload

from fastapi.templating import Jinja2Templates
Expand Down
4 changes: 0 additions & 4 deletions fastapi_server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@
from routes.htmx_chat import htmx_chat_router
from routes.htmx_todolist import htmx_todolist_router
from routes.login_logout import login_router
from routes.replay_parser import replay_parser_router
from routes.twitch_clipper import clip_router

assert os.getenv("STAGE", "DEV") in {"DEV", "PROD"}, os.getenv("STAGE")
STAGE: Literal["DEV", "PROD"] = os.getenv("STAGE", "DEV") # pyre-fixme[9]
BACKEND_SERVER_URL = os.getenv("BACKEND_SERVER_URL", "0.0.0.0:8000")

app = FastAPI()
app.include_router(replay_parser_router)
app.include_router(clip_router)
app.include_router(htmx_todolist_router)
app.include_router(htmx_chat_router)
app.include_router(login_router)
Expand Down
495 changes: 2 additions & 493 deletions fastapi_server/poetry.lock

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions fastapi_server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = ""
authors = ["BuRny <[email protected]>"]

[tool.poetry.dependencies]
python = ">=3.8.1 <3.13"
python = ">=3.10 <3.12"
# Write and read classes to/from json
# Fastapi server
fastapi = "^0.103.1"
Expand All @@ -17,13 +17,6 @@ jinja2 = "^3.1.2"
colorama = "^0.4.4"
# Simple logger
loguru = "^0.5"
# Replay parser
zephyrus-sc2-parser = "^0.3.7"
# Multipart replay upload
python-multipart = "^0.0.5"
portpicker = "^1.5.2"
# Video downloader
streamlink = "^6.4.2"
# Async postgresql connection
asyncpg = "^0.28.0"
# Timestamps
Expand Down
26 changes: 13 additions & 13 deletions fastapi_server/routes/htmx_todolist.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from fastapi import Form, Request
from fastapi import Request
from fastapi.responses import HTMLResponse
from fastapi.routing import APIRouter
from fastapi.templating import Jinja2Templates

from helper.jinja_renderer import render
from models.todo_item import add_todo, delete_todo, get_all_todos, toggle_todo
from models.todo_item import delete_todo, get_all_todos, toggle_todo

htmx_todolist_router = APIRouter()
index_templates = Jinja2Templates(directory="frontend/todo")
Expand Down Expand Up @@ -32,17 +32,17 @@ async def get_todo_items(request: Request) -> str:
)


@htmx_todolist_router.post("/htmxapi/todo", response_class=HTMLResponse)
async def add_todo_item(request: Request, todotext: str = Form()):
row = await add_todo(todotext)
return render(
templates, "todo_item.html", {
"request": request,
"id": row.get("id"),
"todotext": row.get("todotext"),
"done": row.get("done"),
}
)
# @htmx_todolist_router.post("/htmxapi/todo", response_class=HTMLResponse)
# async def add_todo_item(request: Request, todotext: str = Form()):
# row = await add_todo(todotext)
# return render(
# templates, "todo_item.html", {
# "request": request,
# "id": row.get("id"),
# "todotext": row.get("todotext"),
# "done": row.get("done"),
# }
# )


@htmx_todolist_router.patch("/htmxapi/todo/{todoid}")
Expand Down
83 changes: 0 additions & 83 deletions fastapi_server/routes/replay_parser.py

This file was deleted.

2 changes: 2 additions & 0 deletions fastapi_server/routes/text_to_speech.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import base64
import enum
Expand Down
158 changes: 0 additions & 158 deletions fastapi_server/routes/twitch_clipper.py

This file was deleted.

Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit d6ec23b

Please sign in to comment.