This commit is contained in:
EstrellaXD
2023-05-03 00:49:42 +08:00
parent 9e296b57d6
commit 165e03c656
4 changed files with 9 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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