From 0c583f0cb7e75ac5ae5f8581941db1bde55aaad7 Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Sun, 24 Jul 2022 23:48:00 +0800 Subject: [PATCH] =?UTF-8?q?2.5.17=20-=20=E8=AF=95=E8=BF=90=E8=A1=8C=20WebU?= =?UTF-8?q?I?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + README.md | 5 ++ src/api.py | 13 +-- src/parser/title_parser.py | 1 + templates/index.html | 167 +++---------------------------------- templates/index.js | 5 -- 6 files changed, 24 insertions(+), 168 deletions(-) delete mode 100644 templates/index.js diff --git a/.gitignore b/.gitignore index c340c757..2554eeaf 100644 --- a/.gitignore +++ b/.gitignore @@ -172,3 +172,4 @@ cython_debug/ /src/run_debug.sh /src/debug_run.sh /src/__version__.py +/data/ diff --git a/README.md b/README.md index 3c42a9b9..7a748dfd 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,10 @@ +- 主项目地址:[Github](https://www.github.com/EstrellaXD/Auto_Bangumi) +- 项目资源仓库:[Github](https://www.github.com/EstrellaXD/ab_resources) +- WebUI 仓库:[Github](https://github.com/Rewrite0/Auto_Bangumi_WebUI) + ## AutoBangumi 功能说明 - 简易单次配置就能持续使用 @@ -86,6 +90,7 @@ # 声明 ## 致谢 感谢 [Sean](https://github.com/findix) 提供的大量帮助 +感谢 [Rewrite0](https://github.com/Rewrite0) 开发的 WebUI ## 请我喝一杯咖啡 diff --git a/src/api.py b/src/api.py index f4ac8390..47bfe7a3 100644 --- a/src/api.py +++ b/src/api.py @@ -5,6 +5,7 @@ from uvicorn.config import LOGGING_CONFIG from fastapi import FastAPI, Request from fastapi.responses import HTMLResponse, FileResponse from fastapi.templating import Jinja2Templates +from fastapi.staticfiles import StaticFiles from pydantic import BaseModel import logging @@ -26,16 +27,16 @@ else: app = FastAPI() api_func = APIProcess() +app.mount("/assets", StaticFiles(directory="=/templates/assets"), name="assets") +templates = Jinja2Templates(directory="/templates") -# templates = Jinja2Templates(directory="templates") +@app.get("/", response_class=HTMLResponse) +def index(request: Request): + context = {"request": request} + return templates.TemplateResponse("index.html", context) -# @app.get("/", response_class=HTMLResponse) -# def index(request: Request): -# context = {"request": request} -# return templates.TemplateResponse("index.html", context) - @app.get("/api/v1/data") def get_data(): data = json_config.load(settings.info_path) diff --git a/src/parser/title_parser.py b/src/parser/title_parser.py index 40d69265..8a738d85 100644 --- a/src/parser/title_parser.py +++ b/src/parser/title_parser.py @@ -24,6 +24,7 @@ class TitleParser: tmdb_info = self._tmdb_parser.tmdb_search(title) logger.debug(f"TMDB Matched, official title is {tmdb_info.title_zh}") except Exception as e: + logger.debug(e) logger.warning("Not Matched with TMDB") return title, season if settings.title_language == "zh": diff --git a/templates/index.html b/templates/index.html index 7bb7f8e4..592a2a08 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,162 +1,15 @@ - - + + - - + + + AutoBangumi - + + -
-
-
-
- -
-
-
-
-
-

Configuration

-
-
-
-
-

基础配置

- -
  • -
    -
    -
    -
    -

    RSS link

    -
    -
    - -
    -
    -
    -
    -
  • -
  • -
    -
    -
    -
    -

    HOST

    -
    -
    - -
    -
    -
    -
    -
  • -
  • -
    -
    -
    -
    -

    Username

    -
    -
    - -
    -
    -
    -
    -
  • -
  • -
    -
    -
    -
    -

    Password

    -
    -
    - -
    -
    -
    -
    -
  • -
  • -
    -
    -
    -
    -

    Download Path

    -
    -
    - -
    -
    -
    -
    -
  • - -
    -
    -
    -
    -
    -

    进阶配置

    - -
  • -
    -
    -
    -

    字幕组 TAG

    -
    - - - - - - -
    -
    -
    -
    -
  • -
  • -
    -
    -
    -

    历史补全

    -
    - - - - - - -
    -
    -
    -
    -
  • -
  • -
    -
    -
    -

    坏种移除

    -
    - - - - - - -
    -
    -
    -
    -
  • -
    -
    -
    -
    - +
    + - \ No newline at end of file + diff --git a/templates/index.js b/templates/index.js deleted file mode 100644 index 58e33404..00000000 --- a/templates/index.js +++ /dev/null @@ -1,5 +0,0 @@ -function postConfig(){ - var httpRequest = new XMLHttpRequest(); - httpRequest.open("POST", "autobangumi", ture) - -} \ No newline at end of file