add some new feature, but it is not working now

This commit is contained in:
EstrellaXD
2022-05-18 22:40:25 +08:00
parent f54df0e675
commit 7df02665d1
3 changed files with 58 additions and 31 deletions

View File

@@ -5,13 +5,21 @@
"NC-Raws",
"Skymoon-Raws",
"天月搬运组",
"LoliHouse",
"ANi",
"❀拨雪寻春❀",
"澄空学园&华盟字幕社"
"LoliHouse"
],
"name_position": [2],
"second_split": true
"first_position": [1],
"split": "/|-",
"name_position": [-2],
"episode_position":[-1]
},
{
"group_name": [
"桜都字幕组"
],
"first_position": [1,2],
"split": "/|-",
"name_position": [-2],
"episode_position":[-1]
},
{
"group_name": [
@@ -29,10 +37,10 @@
"枫叶字幕组",
"雪飘工作室",
"豌豆字幕组",
"云光字幕组"
"云光字幕组",
"悠哈璃羽字幕社"
],
"name_position": [2,3],
"name_position": [1,2],
"second_split": false
},
{
@@ -41,23 +49,18 @@
"爱恋字母社",
"诸神字幕组",
"驯兽师联盟",
"夏沐字幕组"
"夏沐字幕组",
"幻樱",
"动漫国字幕组"
],
"name_position": [3,4],
"name_position": [2,3],
"second_split": false
},
{
"group_name": [
"漫猫字幕组"
],
"name_position": [4,5],
"second_split": false
},
{
"group_name": [
"幻樱"
],
"name_position": [5,7],
"name_position": [3,4],
"second_split": false
}
]

View File

@@ -11,20 +11,47 @@ items = soup.find_all('item')
with open("rule.json") as f:
rules = json.load(f)
split_rule = r"\[|\]|\【|\】|\★|\|\|\(|\)"
bangumi_list = []
bangumi_title = ''
for item in items:
name = item.title.string
bangumi_title = ''
print(name)
exit_flag = False
for rule in rules:
for group in rule["group_name"]:
if re.search(group, name):
exit_flag = True
n = re.split(split_rule, name)
while '' in n:
n.remove('')
for i in rule["name_position"]:
bangumi_title = bangumi_title + ' ' + n[i].strip()
print(bangumi_title)
if bangumi_title not in bangumi_list:
bangumi_list.append(bangumi_title)
break
if exit_flag:
break
break
season_rule = r"Season \d{1,2}|S\d{1,2}|第.*季|.*期"
episode_rule = r"\d{1,2}|第\d{1,2}话"
for item in bangumi_list:
season = re.findall(season_rule, item)
title = re.sub(season_rule, '', item)
try:
season = season[-1]
except IndexError:
season = ""
episode = re.findall(episode_rule, title)
try:
episode = episode[-1]
except IndexError:
episode = ""
title = re.sub(episode_rule, '', title)
t = re.split(r"/|_", title)
while "" in t:
t.remove("")
name = t[-1].strip()
print(name)
print(season)
print(episode)
print(bangumi_list)

View File

@@ -2,12 +2,9 @@ import re
import requests
url = "http://192.168.200.2"
try:
r = requests.get(url)
print(r.content)
except ConnectionError:
print("e")
except KeyboardInterrupt:
print("end")
name = "[IET字幕组][闪电十一人 FF篇][01][1080P][WebRip][繁日双语][AVC AAC][MP4]"
split_rule = r"\[|\]|\【|\】|\★|\|\|\(|\)"
n = re.split(split_rule, name)
while '' in n:
n.remove('')
print(n)