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

This commit is contained in:
EstrellaXD
2023-05-04 12:18:22 +08:00
parent 1cf28654ad
commit 1734d8a378
4 changed files with 34 additions and 4 deletions

View File

@@ -58,7 +58,7 @@ class QbDownloader:
def torrents_delete(self, hash):
return self._client.torrents_delete(
delete_files=False,
delete_files=True,
torrent_hashes=hash
)

View File

@@ -16,10 +16,10 @@ 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"(.*)[\[\ E](\d{1,4}|\d{1,4}\.\d{1,2})(?:v\d{1,2})?(?: )?(?:END)?[\]\ ](.*)",
r"(.*)\[(?:第)?(\d*\.*\d*)[话集話](?:END)?\](.*)",
r"(.*)第(\d*\.*\d*)[话話集](?:END)?(.*)",
r"(.*)EP?(\d{1,4})(.*)",
r"(.*)(?<!\w)EP?(\d+)(?!\w)(.*)",
]
SUBTITLE_LANG = {
@@ -159,3 +159,10 @@ def torrent_parser(
info = rename_init(file_name, folder_name, season, suffix)
return METHODS[method.lower()](info)
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"))

View File

@@ -50,3 +50,12 @@ def test_raw_parser():
assert info.resolution == "1080P"
assert info.episode == 2
assert info.season == 1
content = "[MagicStar] 假面骑士Geats / 仮面ライダーギーツ EP33 [WEBDL] [1080p] [TTFC]【生】"
info = raw_parser(content)
assert info.group == "MagicStar"
assert info.title_zh == "假面骑士Geats"
assert info.title_jp == "仮面ライダーギーツ"
assert info.resolution == "1080p"
assert info.episode == 33
assert info.season == 1

View File

@@ -23,4 +23,18 @@ def test_torrent_parser():
season = 1
suffix = ".mkv"
assert torrent_parser(file_name, folder_name, season, suffix, "pn") == "Heavenly Delusion S01E01.mkv"
assert torrent_parser(file_name, folder_name, season, suffix, "advance") == "天国大魔境(2023) S01E01.mkv"
assert torrent_parser(file_name, folder_name, season, suffix, "advance") == "天国大魔境(2023) S01E01.mkv"
file_name = "[SBSUB][Kanojo mo Kanojo][01][GB][1080P](456E234).mp4"
folder_name = "女友也要有"
season = 1
suffix = ".mp4"
assert torrent_parser(file_name, folder_name, season, suffix, "pn") == "Kanojo mo Kanojo S01E01.mp4"
assert torrent_parser(file_name, folder_name, season, suffix, "advance") == "女友也要有 S01E01.mp4"
file_name = "[SBSUB][CONAN][1082][V2][1080P][AVC_AAC][CHS_JP](C1E4E331).mp4"
folder_name = "名侦探柯南(1996)"
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"