mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-28 20:40:47 +08:00
Fix RequestContent(), fix renamer.py
This commit is contained in:
33
src/.dockerignore
Normal file
33
src/.dockerignore
Normal file
@@ -0,0 +1,33 @@
|
||||
__pycache__
|
||||
*.pyc
|
||||
*.pyo
|
||||
*.pyd
|
||||
.Python
|
||||
env
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
.tox
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.log
|
||||
.git
|
||||
.mypy_cache
|
||||
../.pytest_cache
|
||||
.hypothesis
|
||||
|
||||
src/module/tests
|
||||
src/module/conf/const_dev.py
|
||||
config/bangumi.json/config/bangumi.json
|
||||
/docs
|
||||
/.github
|
||||
/.config
|
||||
/.data
|
||||
/.cache
|
||||
/LICENSE
|
||||
/README.md
|
||||
/setup.py
|
||||
dist.zip
|
||||
53
src/Dockerfile
Normal file
53
src/Dockerfile
Normal file
@@ -0,0 +1,53 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM python:3.11-alpine AS build
|
||||
|
||||
RUN mkdir /install
|
||||
WORKDIR /install
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN apk update \
|
||||
&& apk add --no-cache \
|
||||
curl \
|
||||
gcc \
|
||||
g++ \
|
||||
linux-headers \
|
||||
|
||||
RUN python3 -m pip install --upgrade pip \
|
||||
&& pip install -r requirements.txt --prefix="/install"
|
||||
|
||||
FROM python:3.11-alpine
|
||||
|
||||
ENV TZ=Asia/Shanghai \
|
||||
PUID=1000 \
|
||||
PGID=1000 \
|
||||
UMASK=022
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build --chmod=777 /install /usr/local
|
||||
COPY --chmod=755 . /app
|
||||
|
||||
RUN apk add --no-cache \
|
||||
curl \
|
||||
shadow \
|
||||
su-exec \
|
||||
bash
|
||||
|
||||
# Download WebUI
|
||||
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 templates
|
||||
|
||||
RUN addgroup -S auto_bangumi -g 1000 && \
|
||||
adduser -S auto_bangumi -G auto_bangumi -h /home/auto_bangumi -u 1000 && \
|
||||
usermod -s /bin/bash auto_bangumi && \
|
||||
mkdir -p "config" && \
|
||||
mkdir -p "data" && \
|
||||
chmod a+x \
|
||||
run.sh
|
||||
|
||||
EXPOSE 7892
|
||||
|
||||
VOLUME [ "/app/config" , "/app/data"]
|
||||
|
||||
CMD ["sh", "run.sh"]
|
||||
21
src/main.py
21
src/main.py
@@ -4,15 +4,14 @@ from module import api
|
||||
import multiprocessing
|
||||
|
||||
if __name__ == "__main__":
|
||||
# num_processes = 2
|
||||
# processes = []
|
||||
# p1 = multiprocessing.Process(target=app.run)
|
||||
# p2 = multiprocessing.Process(target=api.run)
|
||||
# process_list = [p1, p2]
|
||||
# for p in process_list:
|
||||
# p.start()
|
||||
# processes.append(p)
|
||||
# for p in processes:
|
||||
# p.join()
|
||||
app.run()
|
||||
num_processes = 2
|
||||
processes = []
|
||||
p1 = multiprocessing.Process(target=app.run)
|
||||
p2 = multiprocessing.Process(target=api.run)
|
||||
process_list = [p1, p2]
|
||||
for p in process_list:
|
||||
p.start()
|
||||
processes.append(p)
|
||||
for p in processes:
|
||||
p.join()
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import logging
|
||||
from .core import APIProcess
|
||||
from .conf import settings, DATA_PATH, LOG_PATH
|
||||
from .utils import json_config
|
||||
from .models.api import *
|
||||
from models.api import *
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -66,18 +66,3 @@ class FullSeasonGet:
|
||||
logger.info("Completed!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
a = FullSeasonGet()
|
||||
data = {
|
||||
"official_title": "指名!",
|
||||
"title_raw": "CUE!",
|
||||
"season": 1,
|
||||
"season_raw": "",
|
||||
"group": "喵萌Production",
|
||||
"dpi": "1080p",
|
||||
"source": None,
|
||||
"subtitle": "简日双语",
|
||||
"added": True,
|
||||
"eps_collect": True
|
||||
}
|
||||
print(a.init_eps_complete_search_str(data))
|
||||
|
||||
@@ -65,8 +65,9 @@ class Renamer:
|
||||
try:
|
||||
new_name = self._renamer.download_parser(name, folder_name, season, suffix, settings.bangumi_manage.rename_method)
|
||||
if path_name != new_name:
|
||||
old_name = os.path.basename(info.content_path)
|
||||
self.client.rename_torrent_file(torrent_hash, new_name, old_name, new_name)
|
||||
old_path = info.content_path.replace(info.save_path, "")
|
||||
old_path = old_path[len(os.path.sep):]
|
||||
self.client.rename_torrent_file(torrent_hash, new_name, old_path, new_name)
|
||||
rename_count += 1
|
||||
else:
|
||||
continue
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
from .bangumi import *
|
||||
@@ -48,6 +48,7 @@ class RequestURL:
|
||||
socks.set_default_proxy(socks.SOCKS5, addr=settings.proxy.host, port=settings.proxy.port, rdns=True,
|
||||
username=settings.proxy.username, password=settings.proxy.password)
|
||||
socket.socket = socks.socksocket
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
self.session.close()
|
||||
|
||||
21
src/requirements.txt
Normal file
21
src/requirements.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
anyio
|
||||
beautifulsoup4
|
||||
lxml
|
||||
certifi
|
||||
charset-normalizer
|
||||
click
|
||||
fastapi
|
||||
h11
|
||||
idna
|
||||
pydantic
|
||||
PySocks
|
||||
qbittorrent-api
|
||||
requests
|
||||
six
|
||||
sniffio
|
||||
soupsieve
|
||||
typing_extensions
|
||||
urllib3
|
||||
uvicorn
|
||||
attrdict
|
||||
jinja2
|
||||
@@ -6,6 +6,5 @@ if [ -f /config/bangumi.json ]; then
|
||||
fi
|
||||
|
||||
|
||||
|
||||
umask ${UMASK}
|
||||
python3 main.py
|
||||
|
||||
Reference in New Issue
Block a user