完善修正功能

This commit is contained in:
EstrellaXD
2022-05-15 23:57:05 +08:00
parent a18eb1d937
commit e9ee4c5102
2 changed files with 12 additions and 30 deletions

View File

@@ -7,18 +7,26 @@
```bash
pip install qbittorrent-api
```
## 使用之前
在 `config.json` 中填入你的 `hostip` `username` `password` `savepath`:
```json
{
"host_ip": "192.168.31.10:8181",
"username": "admin",
"password": "adminadmin",
"savepath": "/downloads/Bangumi"
}
```
## 自动下载规则建立
```shell
python3 rule_set.py --name <新番名称>
```
# 不符合规则的番剧重命名
## 使用之前
在 `config.json` 中填入你的 `hostip` `username` `password` `savepath`。
## rename_qb
```shell
python3 rename_qb --help
python3 rename_qb.py --help
```
目前有三种重命名模式
- `--method normal`: 普通模式,直接重命名,保留番剧字幕组信息。

26
test.py
View File

@@ -1,26 +0,0 @@
import re
import os
file_name = '[Sakurato] Machikado Mazoku 2-choume [06][AVC-8bit 1080P AAC][CHS]'
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)? (.*)']
def new_name(name):
n = re.split(r'\[|\]', name)
file_name = name.replace(f'[{n[1]}]', '')
for rule in episode_rules:
matchObj = re.match(rule, file_name, re.I)
if matchObj is not None:
new_name = f'{matchObj.group(1)}E{matchObj.group(2)} {matchObj.group(3)}'
return new_name
print(new_name(file_name))