mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-13 18:11:03 +08:00
fix: clean some code. add some config into gitignore.
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -178,6 +178,7 @@ test.*
|
||||
/backend/src/config/
|
||||
/src/debuger.py
|
||||
/backend/src/dist.zip
|
||||
/pyrightconfig.json
|
||||
|
||||
# webui
|
||||
logs
|
||||
@@ -208,4 +209,3 @@ dist-ssr
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ if VERSION != "DEV_VERSION":
|
||||
@app.get("/favicon-light.svg", tags=["html"])
|
||||
def favicon_light():
|
||||
return FileResponse("dist/favicon-light.svg")
|
||||
|
||||
|
||||
@app.get("/robots.txt", tags=["html"])
|
||||
def robots():
|
||||
return FileResponse("dist/robots.txt")
|
||||
@@ -70,10 +70,12 @@ if VERSION != "DEV_VERSION":
|
||||
return templates.TemplateResponse("index.html", context)
|
||||
|
||||
else:
|
||||
|
||||
@app.get("/", status_code=302, tags=["html"])
|
||||
def index():
|
||||
return RedirectResponse("/docs")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
uvicorn.run(
|
||||
app,
|
||||
|
||||
@@ -73,15 +73,6 @@ class BangumiDatabase(Connector):
|
||||
location = {"title_raw": title_raw}
|
||||
set_value = {"rss_link": rss_set, "added": 0}
|
||||
self.update.value(location, set_value)
|
||||
# self._cursor.execute(
|
||||
# """
|
||||
# UPDATE bangumi
|
||||
# SET rss_link = :rss_link, added = 0
|
||||
# WHERE title_raw = :title_raw
|
||||
# """,
|
||||
# {"rss_link": rss_set, "title_raw": title_raw},
|
||||
# )
|
||||
# self._conn.commit()
|
||||
logger.debug(f"[Database] Update {title_raw} rss_link to {rss_set}.")
|
||||
|
||||
def update_poster(self, title_raw, poster_link: str):
|
||||
@@ -109,14 +100,6 @@ class BangumiDatabase(Connector):
|
||||
logger.debug(f"[Database] Find bangumi id: {_id}.")
|
||||
return self.__db_to_data(dict_data)
|
||||
|
||||
# def search_official_title(self, official_title: str) -> BangumiData | None:
|
||||
# dict_data = self._search_data(
|
||||
# table_name=self.__table_name, condition={"official_title": official_title}
|
||||
# )
|
||||
# if dict_data is None:
|
||||
# return None
|
||||
# return self.__db_to_data(dict_data)
|
||||
|
||||
def match_poster(self, bangumi_name: str) -> str:
|
||||
condition = {"official_title": bangumi_name}
|
||||
keys = ["poster_link"]
|
||||
|
||||
@@ -44,3 +44,8 @@ def test_database():
|
||||
# delete
|
||||
database.delete_one(1)
|
||||
assert database.search_id(1) is None
|
||||
|
||||
# Delete test database
|
||||
import os
|
||||
|
||||
os.remove(TEST_PATH)
|
||||
|
||||
Reference in New Issue
Block a user