Fix RequestContent(), fix renamer.py

This commit is contained in:
EstrellaXD
2023-03-14 23:11:45 +08:00
parent 34216245f7
commit cc65c07886
14 changed files with 31 additions and 35 deletions

View File

@@ -8,6 +8,9 @@ jobs:
latest:
runs-on: ubuntu-latest
steps:
- name: Enter directory
run: |
cd src
- name: Checkout
uses: actions/checkout@v3
- name: Create Version info

View File

@@ -9,12 +9,15 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Enter directory
run: |
cd src
-
name: Checkout
uses: actions/checkout@v3
- name: Create Version info
run: |
echo "version='$GITHUB_REF_NAME'" > src/module/__version__.py
echo "VERSION = '$GITHUB_REF_NAME'" > module/__version__.py
- name: Docker meta
id: meta
uses: docker/metadata-action@v4

View File

@@ -22,6 +22,10 @@ jobs:
with:
python-version: "3.11"
- name: Enter directory
run: |
cd src
- name: Install dependencies
run: |
python -m pip install --upgrade pip
@@ -30,5 +34,4 @@ jobs:
- name: Test
run: |
cd src
pytest test/test_raw_parser.py

1
.gitignore vendored
View File

@@ -178,3 +178,4 @@ test.*
/src/templates/
/src/config/
/src/debuger.py

View File

@@ -16,7 +16,7 @@ coverage.xml
*.log
.git
.mypy_cache
.pytest_cache
../.pytest_cache
.hypothesis
src/module/tests

View File

@@ -25,7 +25,7 @@ ENV TZ=Asia/Shanghai \
WORKDIR /app
COPY --from=build --chmod=777 /install /usr/local
COPY --chmod=755 src/. /app
COPY --chmod=755 . /app
RUN apk add --no-cache \
curl \
@@ -48,6 +48,6 @@ RUN addgroup -S auto_bangumi -g 1000 && \
EXPOSE 7892
VOLUME [ "config" , "data"]
VOLUME [ "/app/config" , "/app/data"]
CMD ["sh", "run.sh"]

View File

@@ -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()

View File

@@ -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__)

View File

@@ -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))

View File

@@ -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

View File

@@ -0,0 +1 @@
from .bangumi import *

View File

@@ -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()

View File

@@ -6,6 +6,5 @@ if [ -f /config/bangumi.json ]; then
fi
umask ${UMASK}
python3 main.py