mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-24 02:20:38 +08:00
完善修正功能
This commit is contained in:
@@ -15,7 +15,7 @@ pip install qbittorrent-api
|
||||
"username": "admin",
|
||||
"password": "adminadmin",
|
||||
"savepath": "/downloads/Bangumi",
|
||||
"method": "pr"
|
||||
"method": "pn"
|
||||
}
|
||||
```
|
||||
## 自动下载规则建立
|
||||
@@ -31,7 +31,7 @@ python3 rename_qb.py --help
|
||||
```
|
||||
目前有三种重命名模式
|
||||
- `normal`: 普通模式,直接重命名,保留番剧字幕组信息。
|
||||
- `pr`: 纯净模式,保留番剧名称和剧集信息,去掉多余信息。
|
||||
- `pn`: 纯净模式,保留番剧名称和剧集信息,去掉多余信息。
|
||||
- `hash`: 哈希模式,用于 Torrent 软件完成之后执行命令。
|
||||
|
||||
然后运行 `rename_qb.py` 即可, 如果只想对新番进行重命名,可以在程序中添加添加 `categories="Bangumi"` 语句
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
"username": "admin",
|
||||
"password": "adminadmin",
|
||||
"savepath": "/downloads/Bangumi",
|
||||
"method": "pr"
|
||||
"method": "pn"
|
||||
}
|
||||
12
rename_qb.py
12
rename_qb.py
@@ -58,8 +58,10 @@ class Qbtorrent_Rename:
|
||||
if matchObj is not None:
|
||||
if self.method == 'normal':
|
||||
self.new_name = f'{matchObj.group(1)} E{matchObj.group(2)} {matchObj.group(3)}'
|
||||
elif self.method == 'pr':
|
||||
self.new_name = f'{matchObj.group(1)} E{matchObj.group(2)}'
|
||||
elif self.method == 'pn':
|
||||
new_name = f'{matchObj.group(1)} E{matchObj.group(2)}.mp4'
|
||||
new_name = new_name.replace('[', '')
|
||||
self.new_name = new_name.replace(']', '')
|
||||
|
||||
def qb_rename(self, idx, torrent_hash=''):
|
||||
self.rename(idx)
|
||||
@@ -70,7 +72,7 @@ class Qbtorrent_Rename:
|
||||
try:
|
||||
self.qbt_client.torrents_rename_file(torrent_hash=self.hash, old_path=self.name, new_path=self.new_name)
|
||||
self.count += 1
|
||||
print('{} >> {}'.format(self.name, self.new_name))
|
||||
print(f'{self.name} >> {self.new_name}')
|
||||
except:
|
||||
return
|
||||
self.new_name = None
|
||||
@@ -78,7 +80,7 @@ class Qbtorrent_Rename:
|
||||
|
||||
def app():
|
||||
args = parser.parse_args()
|
||||
if method not in ['hash', 'pr', 'normal']:
|
||||
if method not in ['hash', 'pn', 'normal']:
|
||||
print("Not a correct method")
|
||||
quit()
|
||||
qb = Qbtorrent_Rename(method=method)
|
||||
@@ -89,7 +91,7 @@ def app():
|
||||
except:
|
||||
print('error')
|
||||
quit()
|
||||
elif method == 'pr':
|
||||
elif method == 'pn':
|
||||
for i in range(0, qb.torrent_count + 1):
|
||||
try:
|
||||
qb.qb_rename(i)
|
||||
|
||||
Reference in New Issue
Block a user