diff --git a/src/module/core/api_func.py b/src/module/core/api_func.py index 071fe083..69bc482a 100644 --- a/src/module/core/api_func.py +++ b/src/module/core/api_func.py @@ -59,7 +59,6 @@ class APIProcess: json_config.save(DATA_PATH, datas) return "Success" - @staticmethod def add_rule(title, season): data = json_config.load(DATA_PATH) diff --git a/src/module/network/request_contents.py b/src/module/network/request_contents.py index 546edffd..1678390c 100644 --- a/src/module/network/request_contents.py +++ b/src/module/network/request_contents.py @@ -3,7 +3,6 @@ import xml.etree.ElementTree from dataclasses import dataclass from .request_url import RequestURL - from module.conf import settings FILTER = "|".join(settings.rss_parser.filter) @@ -17,7 +16,7 @@ class TorrentInfo: class RequestContent(RequestURL): # Mikanani RSS - def get_torrents(self, _url: str, filter: bool = True) -> [TorrentInfo]: + def get_torrents(self, _url: str, _filter: bool = True) -> [TorrentInfo]: soup = self.get_xml(_url) torrent_titles = [] torrent_urls = [] @@ -28,7 +27,7 @@ class RequestContent(RequestURL): torrents = [] for _title, torrent_url in zip(torrent_titles, torrent_urls): - if filter: + if _filter: if re.search(FILTER, _title) is None: torrents.append(TorrentInfo(_title, torrent_url)) else: diff --git a/src/module/parser/analyser/__init__.py b/src/module/parser/analyser/__init__.py index 37216c88..a4cb6896 100644 --- a/src/module/parser/analyser/__init__.py +++ b/src/module/parser/analyser/__init__.py @@ -1,4 +1,4 @@ from .raw_parser import raw_parser -from .rename_parser import torrent_parser +from .torrent_parser import torrent_parser from .tmdb_parser import TMDBMatcher diff --git a/src/module/parser/analyser/rename_parser.py b/src/module/parser/analyser/torrent_parser.py similarity index 89% rename from src/module/parser/analyser/rename_parser.py rename to src/module/parser/analyser/torrent_parser.py index 5ea2e984..dfcb8418 100644 --- a/src/module/parser/analyser/rename_parser.py +++ b/src/module/parser/analyser/torrent_parser.py @@ -4,6 +4,7 @@ from dataclasses import dataclass logger = logging.getLogger(__name__) + @dataclass class DownloadInfo: name: str @@ -16,11 +17,9 @@ class DownloadInfo: RULES = [ r"(.*) - (\d{1,4}|\d{1,4}\.\d{1,2})(?:v\d{1,2})?(?: )?(?:END)?(.*)", r"(.*)[\[ E](\d{1,3}|\d{1,3}\.\d{1,2})(?:v\d{1,2})?(?: )?(?:END)?[\] ](.*)", - r"(.*)\[第(\d*\.*\d*)话(?:END)?\](.*)", - r"(.*)\[第(\d*\.*\d*)話(?:END)?\](.*)", - r"(.*)第(\d*\.*\d*)话(?:END)?(.*)", - r"(.*)第(\d*\.*\d*)話(?:END)?(.*)", - r"(.*)E(\d{1,3})(.*)", + r"(.*)\[(?:第)?(\d*\.*\d*)[话集話](?:END)?\](.*)", + r"(.*)第(\d*\.*\d*)[话話集](?:END)?(.*)", + r"(.*)E(\d{1,4})(.*)", ] @@ -109,6 +108,6 @@ def torrent_parser( if __name__ == "__main__": - name = "[Lilith-Raws] Tate no Yuusha no Nariagari S02 - 02 [Baha][WEB-DL][1080p][AVC AAC][CHT][MP4]" - new_name = torrent_parser(name, "异世界舅舅(2022)", 2, ".mp4", "advance") + name = "[织梦字幕组][鬼灭之刃 锻刀村篇 鬼滅の刃 刀鍛冶の里編][01集][1080P][AVC][简日双语].mp4" + new_name = torrent_parser(name, "异世界舅舅(2022)", 2, ".mp4", "pn") print(new_name)