This commit is contained in:
EstrellaXD
2022-05-18 00:42:34 +08:00
parent 2000f626dc
commit 565423d5d4
2 changed files with 18 additions and 12 deletions

View File

@@ -65,7 +65,7 @@ class QbittorrentRename:
def rename(self):
if self.path_name != self.new_name:
self.qbt_client.torrents_rename_file(torrent_hash=self.hash, old_path=self.name, new_path=self.new_name)
self.qbt_client.torrents_rename_file(torrent_hash=self.hash, old_path=self.path_name, new_path=self.new_name)
print(f'{self.name} >> {self.new_name}')
self.count += 1
else:

View File

@@ -6,25 +6,31 @@ from bs4 import BeautifulSoup
episode_rules = [r'(.*)\[(\d{1,3}|\d{1,3}\.\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'(.*)- (\d{1,3}|\d{1,3}\.\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'(\[.*\])?(.*)(S\d{1,3}) - (\d{1,3}|\d{1,3}\.\d{1,2})(?:v\d{1,2})?(?:END)? (.*)']
name = "[NC-Raws] 小书痴的下克上:为了成为图书管理员不择手段!第三季 / Honzuki no Gekokujou S3 - 32 (Baha 1920x1080 AVC AAC MP4)"
parrten = r'\[|\]|\u3010|\u3011|\★|\*|\(|\)|\|\'
for i in range(2):
"""for i in range(2):
n = re.split(parrten, name)
try:
name = re.sub(f'\[{n[1]}\]|【{n[1]}】|★{n[1]}', '', name)
except:
name = name
for rule in episode_rules:
name = name"""
"""for rule in episode_rules:
matchObj = re.match(rule, name, re.I)
if matchObj is not None:
new_name = re.sub(r'\[|\]', '', f'{matchObj.group(1)}')
new_name = re.sub(r'\[|\]', '', f'{matchObj.group(2)}')
new_name = re.split(r'/', new_name)[-1].strip()
print(new_name)
print(new_name)"""
rule = r"(\[.*\]|\(.*\)|\【.*\】|\.*\)(.*)?/(.*)- (\d{1,3}|\d{1,3}\.\d{1,2})(?:v\d{1,2})?(?:END)? (.*)?"
n = re.match(rule, name, re.I)
for i in range(1, 3):
b = n.group().count()
print(n.group(b-i))