diff --git a/Dockerfile b/Dockerfile index edb95e8d..d0209137 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,9 +26,9 @@ RUN apk add --no-cache \ bash # Download WebUI -RUN wget https://github.com/Rewrite0/Auto_Bangumi_WebUI/releases/download/v1.0.4/dist.zip && \ +RUN wget "https://github.com/Rewrite0/Auto_Bangumi_WebUI/releases/download/$(curl 'https://api.github.com/repos/Rewrite0/Auto_Bangumi_WebUI/releases/latest' | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')/dist.zip" && \ unzip dist.zip && \ - mv dist template + mv dist templates RUN addgroup -S auto_bangumi -g 1000 && \ adduser -S auto_bangumi -G auto_bangumi -h /home/auto_bangumi -u 1000 && \ diff --git a/module/api.py b/module/api.py index 82ca6e03..7c7c6a2c 100644 --- a/module/api.py +++ b/module/api.py @@ -12,16 +12,7 @@ from conf import settings, parse from utils import json_config logger = logging.getLogger(__name__) -args = parse() -if args.debug: - try: - from conf.const_dev import DEV_SETTINGS - settings.init(DEV_SETTINGS) - except ModuleNotFoundError: - logger.debug("Please copy `const_dev.py` to `const_dev.py` to use custom settings") -else: - settings.init() app = FastAPI() api_func = APIProcess() diff --git a/module/core/download_client.py b/module/core/download_client.py index 1b63e37e..9fa21879 100644 --- a/module/core/download_client.py +++ b/module/core/download_client.py @@ -44,7 +44,7 @@ class DownloadClient: "savePath": str( os.path.join( settings.downloader.path, - re.sub(r"\:|\/|\.", " ", official_name).strip(), + re.sub(r"[:/.]", " ", official_name).strip(), f"Season {season}", ) ), diff --git a/module/core/download_fliter.py b/module/core/download_fliter.py index 6a0011b1..9bd8f040 100644 --- a/module/core/download_fliter.py +++ b/module/core/download_fliter.py @@ -3,8 +3,8 @@ import logging from bs4 import BeautifulSoup -from conf import settings -from utils import json_config +from module.conf import settings +from module.utils import json_config logger = logging.getLogger(__name__) diff --git a/module/core/eps_complete.py b/module/core/eps_complete.py index 31881cb4..2954d5cf 100644 --- a/module/core/eps_complete.py +++ b/module/core/eps_complete.py @@ -4,6 +4,7 @@ import logging from module.conf import settings from module.network import RequestContent + from .download_client import DownloadClient logger = logging.getLogger(__name__) diff --git a/module/core/repath.py b/module/core/repath.py index d11bbd24..48bc6b7b 100644 --- a/module/core/repath.py +++ b/module/core/repath.py @@ -3,9 +3,9 @@ import re from dataclasses import dataclass from pathlib import PurePath, PureWindowsPath -from core import DownloadClient -from conf import settings -from utils import json_config +from module.core import DownloadClient +from module.conf import settings +from module.utils import json_config logger = logging.getLogger(__name__) @@ -85,11 +85,3 @@ class RePath: logging.info(f"Starting repath process.") for list in match_list: self.re_path(list) - - -if __name__ == '__main__': - from conf.const_dev import DEV_SETTINGS - settings.init(DEV_SETTINGS) - client = DownloadClient() - r = RePath(client) - r.run() diff --git a/module/getWebUI.sh b/module/getWebUI.sh deleted file mode 100755 index 9a8250b6..00000000 --- a/module/getWebUI.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -webDir=/templates -versionFile=$webDir/version -version=$AB_WEBUI_VERSION - -echo '获取webui最新版本号' -tag=$(curl 'https://api.github.com/repos/Rewrite0/Auto_Bangumi_WebUI/releases/latest' | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g') -if [ -f $versionFile ]; then - oldTag=$(cat $versionFile) -fi - -getWeb() { - echo '准备下载最新版本webui' - wget https://ghproxy.com/https://github.com/Rewrite0/Auto_Bangumi_WebUI/releases/download/$1/dist.zip - file=./dist.zip - - # 检查是否下载完成 - if [ -f $file ]; then - unzip $file - rm $file && mv dist $webDir - echo $1 > $versionFile - echo 'webui下载完成' - else - echo 'webui下载失败, 重新下载' - getWeb $1 - fi -} - -reGetWeb() { - rm -rf $webDir - getWeb $1 -} - -# 检查是否指定了版本号 -if [ $version ]; then - - # 检查是否有旧版本 - if [ $oldTag ]; then - if [ $version == $oldTag ]; then - echo '版本一致, 无需更新' - else - reGetWeb $version - fi - else - getWeb $version - fi - -else - - # 检查是否有旧版本 - if [ $oldTag ]; then - - # 版本不符则下载最新版本 - if [ $tag != $oldTag ]; then - reGetWeb $tag - else - echo '当前webui为最新版本, 无需更新' - fi - - else - getWeb $tag - fi -fi