优化字幕检测

This commit is contained in:
lededev
2022-04-10 03:12:03 +08:00
parent 109cc3717b
commit 3e3ff3cfb3
2 changed files with 7 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ import re
import sys
import configparser
import time
import typing
from pathlib import Path
G_conf_override = {
@@ -263,8 +264,8 @@ class Config:
def media_type(self) -> str:
return self.conf.get('media', 'media_type')
def sub_rule(self):
return self.conf.get('media', 'sub_type').split(',')
def sub_rule(self) -> typing.Set[str]:
return set(self.conf.get('media', 'sub_type').lower().split(','))
def naming_rule(self) -> str:
return self.conf.get("Name_Rule", "naming_rule")
@@ -445,9 +446,9 @@ class Config:
sec11 = "media"
conf.add_section(sec11)
conf.set(sec11, "media_type",
".mp4,.avi,.rmvb,.wmv,.mov,.mkv,.flv,.ts,.webm,.MP4,.AVI,.RMVB,.WMV,.MOV,.MKV,.FLV,.TS,.WEBM,iso,ISO")
".mp4,.avi,.rmvb,.wmv,.mov,.mkv,.flv,.ts,.webm,iso")
conf.set(sec11, "sub_type",
".smi,.srt,.idx,.sub,.sup,.psb,.ssa,.ass,.txt,.usf,.xss,.ssf,.rt,.lrc,.sbv,.vtt,.ttml")
".smi,.srt,.idx,.sub,.sup,.psb,.ssa,.ass,.usf,.xss,.ssf,.rt,.lrc,.sbv,.vtt,.ttml")
sec12 = "watermark"
conf.add_section(sec12)

View File

@@ -521,7 +521,7 @@ def paste_file_to_folder(filepath, path, multi_part, number, part, leak_word, c_
except:
os.symlink(str(filepath_obj.resolve()), targetpath)
sub_res = [subext.lower() for subext in config.getInstance().sub_rule()]
sub_res = config.getInstance().sub_rule()
for subfile in filepath_obj.parent.glob('**/*'):
if subfile.is_file() and subfile.suffix.lower() in sub_res:
if multi_part and part.lower() not in subfile.name.lower():
@@ -572,7 +572,7 @@ def paste_file_to_folder_mode2(filepath, path, multi_part, number, part, leak_wo
except:
os.symlink(str(filepath_obj.resolve()), targetpath)
sub_res = [subext.lower() for subext in config.getInstance().sub_rule()]
sub_res = config.getInstance().sub_rule()
for subfile in filepath_obj.parent.glob('**/*'):
if subfile.is_file() and subfile.suffix.lower() in sub_res:
if multi_part and part.lower() not in subfile.name.lower():