Merge remote-tracking branch 'origin/2.6.0-dev' into 2.6.0-dev

# Conflicts:
#	Dockerfile
This commit is contained in:
EstrellaXD
2023-03-05 13:32:58 +08:00
7 changed files with 24 additions and 17 deletions

View File

@@ -29,4 +29,5 @@ config/bangumi.json/config/bangumi.json
/.cache
/LICENSE
/README.md
/setup.py
/setup.py
dist.zip

View File

@@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v3
- name: Create Version info
run: |
echo "version = '$GITHUB_REF_NAME'" > src/__version__.py
echo "version='$GITHUB_REF_NAME'" > module/conf/version.py
- name: Docker meta
id: meta
uses: docker/metadata-action@v4

View File

@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM python:3.10-buster AS build
FROM python:3.11-buster AS build
RUN mkdir /install
WORKDIR /install
@@ -7,17 +7,17 @@ COPY requirements.txt .
RUN python3 -m pip install --upgrade pip \
&& pip install -r requirements.txt --prefix="/install"
FROM python:3.10-alpine
FROM python:3.11-alpine
ENV TZ=Asia/Shanghai \
PUID=1000 \
PGID=1000 \
UMASK=022
WORKDIR /src
WORKDIR /app
COPY --from=build --chmod=777 /install /usr/local
COPY --chmod=755 module /src
COPY --chmod=755 . .
RUN apk add --no-cache \
curl \
@@ -25,17 +25,21 @@ RUN apk add --no-cache \
su-exec \
bash
# Download WebUI
RUN wget https://github.com/Rewrite0/Auto_Bangumi_WebUI/releases/download/v1.0.4/dist.zip && \
unzip dist.zip && \
mv dist template
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" && \
chmod a+x \
run.sh \
getWebUI.sh \
setID.sh
EXPOSE 7892
VOLUME [ "/config" ]
VOLUME [ "/config" , "/data"]
CMD ["sh", "run.sh"]

View File

@@ -80,11 +80,11 @@ class DownloadClient:
status_filter="completed", category="Bangumi"
)
def rename_torrent_file(self, hash, path_name, new_name):
def rename_torrent_file(self, hash, new_file_name, old_path, new_path):
self.client.torrents_rename_file(
torrent_hash=hash, old_path=path_name, new_path=new_name
torrent_hash=hash, new_file_name=new_file_name, old_path=old_path, new_path=new_path
)
logger.info(f"{path_name} >> {new_name}")
logger.info(f"{old_path} >> {new_path}, new name {new_file_name}")
def delete_torrent(self, hashes):
self.client.torrents_delete(

View File

@@ -65,7 +65,8 @@ class Renamer:
try:
new_name = self._renamer.download_parser(name, folder_name, season, suffix, settings.bangumi_manage.rename_method)
if path_name != new_name:
self.client.rename_torrent_file(torrent_hash, path_name, new_name)
old_name = info.content_path.replace(info.save_path, "")
self.client.rename_torrent_file(torrent_hash, new_name, old_name, new_name)
rename_count += 1
else:
continue

View File

@@ -56,8 +56,9 @@ class QbDownloader:
torrent_hashes=hash
)
def torrents_rename_file(self, torrent_hash, old_path, new_path):
self._client.torrents_rename_file(torrent_hash=torrent_hash, old_path=old_path, new_path=new_path)
def torrents_rename_file(self, torrent_hash, new_file_name, old_path, new_path):
self._client.torrents_rename_file(torrent_hash=torrent_hash, new_file_name=new_file_name,
old_path=old_path, new_path=new_path)
def get_rss_info(self):
item = self._client.rss_items().get("Mikan_RSS")

View File

@@ -65,8 +65,8 @@ class RawParser:
name = re.sub(season_rule, "", name_season)
for season in seasons:
season_raw = season
if re.search(r"S|Season", season) is not None:
season = int(re.sub(r"S|Season", "", season))
if re.search(r"Season|S", season) is not None:
season = int(re.sub(r"Season|S", "", season))
break
elif re.search(r"[第 ].*[季期]", season) is not None:
season_pro = re.sub(r"[第季期 ]", "", season)
@@ -148,7 +148,7 @@ class RawParser:
sub, dpi, source = self.find_tags(other) # 剩余信息处理
return name_en, name_zh, name_jp, season, season_raw, episode, sub, dpi, source, group
def analyse(self, raw: str) -> Episode or None:
def analyse(self, raw: str) -> Episode | None:
try:
ret = self.process(raw)
if ret is None: