Fix renamer 不能重命名1000集以上的问题

This commit is contained in:
EstrellaXD
2023-05-04 18:44:12 +08:00
parent b9dbdf7907
commit b307e828a7
3 changed files with 15 additions and 7 deletions

View File

@@ -199,3 +199,4 @@ class Renamer:
)
else:
logger.warning(f"{info.name} has no media file")

View File

@@ -19,7 +19,7 @@ RULES = [
r"(.*)[\[\ E](\d{1,4}|\d{1,4}\.\d{1,2})(?:v\d{1,2})?(?: )?(?:END)?[\]\ ](.*)",
r"(.*)\[(?:第)?(\d*\.*\d*)[话集話](?:END)?\](.*)",
r"(.*)第(\d*\.*\d*)[话話集](?:END)?(.*)",
r"(.*)(?<!\w)EP?(\d+)(?!\w)(.*)",
r"(.*)(?:S\d{2})?EP?(\d+)(.*)",
]
SUBTITLE_LANG = {
@@ -161,8 +161,8 @@ def torrent_parser(
if __name__ == '__main__':
title = "[MagicStar] 假面骑士Geats / 仮面ライダーギーツ EP33 [WEBDL] [1080p] [TTFC]【生】"
folder_name = "名侦探柯南"
season = 1
suffix = ".mp4"
print(torrent_parser(title, folder_name, season, suffix, method="pn"))
title = "海盗战记 S02E17.zh.ass"
folder_name = "海盗战记"
season = 2
suffix = ".ass"
print(torrent_parser(title, folder_name, season, suffix, method="advance"))

View File

@@ -37,4 +37,11 @@ def test_torrent_parser():
season = 1
suffix = ".mp4"
assert torrent_parser(file_name, folder_name, season, suffix, "pn") == "CONAN S01E1082.mp4"
assert torrent_parser(file_name, folder_name, season, suffix, "advance") == "名侦探柯南(1996) S01E1082.mp4"
assert torrent_parser(file_name, folder_name, season, suffix, "advance") == "名侦探柯南(1996) S01E1082.mp4"
file_name = "海盗战记 S01E01.mp4"
folder_name = "海盗战记(2021)"
season = 1
suffix = ".mp4"
assert torrent_parser(file_name, folder_name, season, suffix, "pn") == "海盗战记 S01E01.mp4"
assert torrent_parser(file_name, folder_name, season, suffix, "advance") == "海盗战记(2021) S01E01.mp4"