Skip to content

Commit a0a7018

Browse files
committed
fix rename error: will rename .5 and v1
1 parent 5673d6d commit a0a7018

7 files changed

Lines changed: 425 additions & 418 deletions

File tree

backend/pyproject.toml

Lines changed: 92 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -5,110 +5,110 @@ description = "Add your description here"
55
readme = "README.md"
66
requires-python = ">=3.11"
77
dependencies = [
8-
"bcrypt==4.2.0",
9-
"beautifulsoup4>=4.13.4",
10-
"bencode-py>=4.0.0",
11-
"dotenv>=0.9.9",
12-
"fastapi>=0.116.1",
13-
"httpx[http2,socks]>=0.28.1",
14-
"jinja2>=3.1.6",
15-
"packaging>=25.0",
16-
"passlib>=1.7.4",
17-
"python-jose>=3.5.0",
18-
"python-multipart>=0.0.20",
19-
"sqlmodel>=0.0.24",
20-
"sse-starlette>=3.0.2",
21-
"urllib3>=2.5.0",
22-
"uvicorn>=0.35.0",
8+
"bcrypt==4.2.0",
9+
"beautifulsoup4>=4.13.4",
10+
"bencode-py>=4.0.0",
11+
"dotenv>=0.9.9",
12+
"fastapi>=0.116.1",
13+
"httpx[http2,socks]>=0.28.1",
14+
"jinja2>=3.1.6",
15+
"packaging>=25.0",
16+
"passlib>=1.7.4",
17+
"python-jose>=3.5.0",
18+
"python-multipart>=0.0.20",
19+
"sqlmodel>=0.0.24",
20+
"sse-starlette>=3.0.2",
21+
"urllib3>=2.5.0",
22+
"uvicorn>=0.35.0",
2323
]
2424
[tool.ruff]
2525
select = [
26-
# pycodestyle(E): https://beta.ruff.rs/docs/rules/#pycodestyle-e-w
27-
"E",
28-
# Pyflakes(F): https://beta.ruff.rs/docs/rules/#pyflakes-f
29-
"F",
30-
# isort(I): https://beta.ruff.rs/docs/rules/#isort-i
31-
"I",
26+
# pycodestyle(E): https://beta.ruff.rs/docs/rules/#pycodestyle-e-w
27+
"E",
28+
# Pyflakes(F): https://beta.ruff.rs/docs/rules/#pyflakes-f
29+
"F",
30+
# isort(I): https://beta.ruff.rs/docs/rules/#isort-i
31+
"I",
3232
]
3333
ignore = [
34-
# E501: https://beta.ruff.rs/docs/rules/line-too-long/
35-
'E501',
36-
# F401: https://beta.ruff.rs/docs/rules/unused-import/
37-
# avoid unused imports lint in `__init__.py`
38-
'F401',
34+
# E501: https://beta.ruff.rs/docs/rules/line-too-long/
35+
'E501',
36+
# F401: https://beta.ruff.rs/docs/rules/unused-import/
37+
# avoid unused imports lint in `__init__.py`
38+
'F401',
3939
]
4040

4141
# Allow autofix for all enabled rules (when `--fix`) is provided.
4242
fixable = [
43-
"A",
44-
"B",
45-
"C",
46-
"D",
47-
"E",
48-
"F",
49-
"G",
50-
"I",
51-
"N",
52-
"Q",
53-
"S",
54-
"T",
55-
"W",
56-
"ANN",
57-
"ARG",
58-
"BLE",
59-
"COM",
60-
"DJ",
61-
"DTZ",
62-
"EM",
63-
"ERA",
64-
"EXE",
65-
"FBT",
66-
"ICN",
67-
"INP",
68-
"ISC",
69-
"NPY",
70-
"PD",
71-
"PGH",
72-
"PIE",
73-
"PL",
74-
"PT",
75-
"PTH",
76-
"PYI",
77-
"RET",
78-
"RSE",
79-
"RUF",
80-
"SIM",
81-
"SLF",
82-
"TID",
83-
"TRY",
84-
"UP",
85-
"YTT",
43+
"A",
44+
"B",
45+
"C",
46+
"D",
47+
"E",
48+
"F",
49+
"G",
50+
"I",
51+
"N",
52+
"Q",
53+
"S",
54+
"T",
55+
"W",
56+
"ANN",
57+
"ARG",
58+
"BLE",
59+
"COM",
60+
"DJ",
61+
"DTZ",
62+
"EM",
63+
"ERA",
64+
"EXE",
65+
"FBT",
66+
"ICN",
67+
"INP",
68+
"ISC",
69+
"NPY",
70+
"PD",
71+
"PGH",
72+
"PIE",
73+
"PL",
74+
"PT",
75+
"PTH",
76+
"PYI",
77+
"RET",
78+
"RSE",
79+
"RUF",
80+
"SIM",
81+
"SLF",
82+
"TID",
83+
"TRY",
84+
"UP",
85+
"YTT",
8686
]
8787
unfixable = []
8888

8989
# Exclude a variety of commonly ignored directories.
9090
exclude = [
91-
".bzr",
92-
".direnv",
93-
".eggs",
94-
".git",
95-
".git-rewrite",
96-
".hg",
97-
".mypy_cache",
98-
".nox",
99-
".pants.d",
100-
".pytype",
101-
".ruff_cache",
102-
".svn",
103-
".tox",
104-
".venv",
105-
"__pypackages__",
106-
"_build",
107-
"buck-out",
108-
"build",
109-
"dist",
110-
"node_modules",
111-
"venv",
91+
".bzr",
92+
".direnv",
93+
".eggs",
94+
".git",
95+
".git-rewrite",
96+
".hg",
97+
".mypy_cache",
98+
".nox",
99+
".pants.d",
100+
".pytype",
101+
".ruff_cache",
102+
".svn",
103+
".tox",
104+
".venv",
105+
"__pypackages__",
106+
"_build",
107+
"buck-out",
108+
"build",
109+
"dist",
110+
"node_modules",
111+
"venv",
112112
]
113113
per-file-ignores = {}
114114

@@ -131,6 +131,6 @@ target-version = ['py311']
131131

132132
[dependency-groups]
133133
dev = [
134-
"pytest>=8.4.1",
135-
"pytest-asyncio>=1.1.0",
134+
"pytest>=8.4.1",
135+
"pytest-asyncio>=1.1.0",
136136
]

backend/src/module/downloader/client/openlist/openlist.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import datetime
21
import logging
32
import os
43

backend/src/module/downloader/download_controller.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
from .download_queue import download_queue
1111

1212
logger = logging.getLogger(__name__)
13+
14+
1315
class DownloadController:
1416
def __init__(self):
15-
self._event_bus:EventBus = event_bus
17+
self._event_bus: EventBus = event_bus
1618

1719
# 10秒拿5个
1820
async def download(self):
@@ -52,7 +54,8 @@ async def download(self):
5254

5355
with Database(engine) as database:
5456
for torrent in torrents:
55-
database.torrent.add(torrent)
57+
if torrent.download_uid: # 有下载哈希
58+
database.torrent.add(torrent)
5659
for i, result in enumerate(results):
5760
torrent, bangumi = torrent_bangumi_pairs[i]
5861

backend/src/module/manager/renamer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ async def rename_file(
129129
return True
130130

131131
# .5 的也处理不了, 直接返回 True
132-
if is_point_5(ep.title):
132+
if is_point_5(ep.media_path):
133133
logger.debug(f"[Renamer][rename_file] {ep.title} is a point 5 file")
134134
# Notify = Notification()
135135
return True
136136

137137
# v1 的没必要处理, 直接返回 True
138-
if is_v1(ep.title):
138+
if is_v1(ep.media_path):
139139
logger.debug(f"[Renamer][rename_file] {ep.title} is a vd file")
140140
return True
141141

backend/src/module/parser/analyser/meta_parser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,12 @@ def is_point_5(title: str) -> bool:
451451
# title = "海盗战记 S01E01.SC.ass"
452452
# title = "[LoliHouse] 2.5次元的诱惑 / 2.5-jigen no Ririsa - 01 [WebRip 1080p HEVC-10bit AAC][简繁内封字幕].mkv"
453453
# title = "[桜都字幕组&7³ACG] 摇曳露营 第3季/ゆるキャン△ SEASON3/Yuru Camp S03 | 01-12+New Anime 01-03 [简繁字幕] BDrip 1080p AV1 OPUS 2.0 [复制磁连]"
454+
title = "[三明治摆烂组&Pre-S] 与游戏中心的少女异文化交流的故事 / Game Center Shoujo to Ibunka Kouryuu - 06.5 总集篇 - [简日内嵌][H264 1080P](检索:游乐场少女的异文化交流)"
454455
#
455456
#
456457
# print(re.findall(p.GROUP_RE, title))
457458
res = raw_parser(title)
459+
print(is_point_5(title))
458460
for k, v in res.__dict__.items():
459461
print(f"{k}: {v}")
460462
# print(ret.token)

backend/src/module/rss/engine.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import asyncio
22
import logging
33

4+
from sqlalchemy import Engine
5+
46
from module.database import Database, engine
57
from module.downloader import DownloadQueue, download_queue
68
from module.models import Bangumi, RSSItem, Torrent
@@ -40,14 +42,15 @@ async def pull_rss(self) -> list[Torrent]:
4042

4143

4244
class RSSRefresh(BaseRefresh):
45+
4346
def __init__(self, rss_item: RSSItem, _engine=engine):
4447
super().__init__(_engine)
4548
self.rss_item: RSSItem = rss_item
4649
self.bangumis: list[Bangumi] = []
4750
self.url: str = rss_item.url
4851
self.bangumi: Bangumi | None = None
49-
self.analyser = RSSAnalyser()
50-
self.download_queue = download_queue
52+
self.analyser: RSSAnalyser = RSSAnalyser()
53+
self.download_queue: DownloadQueue = download_queue
5154

5255
async def download_rss(self) -> list[Torrent]:
5356
"""下载 rss_item 对应的 torrents"""
@@ -151,7 +154,7 @@ def __init__(self, bangumi: Bangumi, _engine=engine):
151154
self.bangumi: Bangumi = bangumi
152155
self.url: str = bangumi.rss_link
153156
self.analyser = RSSAnalyser()
154-
self.download_queue:DownloadQueue = download_queue
157+
self.download_queue: DownloadQueue = download_queue
155158

156159
async def refresh(self) -> list[Torrent]:
157160
"""刷新 bangumi 的 rss"""
@@ -214,8 +217,8 @@ class RSSEngine:
214217
"""
215218

216219
def __init__(self, _engine=engine) -> None:
217-
self.engine = _engine
218-
self.queue:DownloadQueue = download_queue
220+
self.engine: Engine = _engine
221+
self.queue: DownloadQueue = download_queue
219222

220223
def get_active_rss(self) -> list[RSSItem]:
221224
"""获取所有活跃的rss"""
@@ -224,7 +227,7 @@ def get_active_rss(self) -> list[RSSItem]:
224227
logger.debug(f"[RSS] get {len(rss_items)} active rss items")
225228
return rss_items
226229

227-
async def refresh_rss(self, rss_item: RSSItem) -> list[Torrent]:
230+
async def refresh_rss(self, rss_item: RSSItem) -> None:
228231
rssrefresh = RSSRefresh(rss_item=rss_item)
229232
await rssrefresh.find_new_bangumi()
230233
await rssrefresh.download_rss()

0 commit comments

Comments
 (0)