优化字幕检测
This commit is contained in:
@@ -3,6 +3,7 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
import configparser
|
import configparser
|
||||||
import time
|
import time
|
||||||
|
import typing
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
G_conf_override = {
|
G_conf_override = {
|
||||||
@@ -263,8 +264,8 @@ class Config:
|
|||||||
def media_type(self) -> str:
|
def media_type(self) -> str:
|
||||||
return self.conf.get('media', 'media_type')
|
return self.conf.get('media', 'media_type')
|
||||||
|
|
||||||
def sub_rule(self):
|
def sub_rule(self) -> typing.Set[str]:
|
||||||
return self.conf.get('media', 'sub_type').split(',')
|
return set(self.conf.get('media', 'sub_type').lower().split(','))
|
||||||
|
|
||||||
def naming_rule(self) -> str:
|
def naming_rule(self) -> str:
|
||||||
return self.conf.get("Name_Rule", "naming_rule")
|
return self.conf.get("Name_Rule", "naming_rule")
|
||||||
@@ -445,9 +446,9 @@ class Config:
|
|||||||
sec11 = "media"
|
sec11 = "media"
|
||||||
conf.add_section(sec11)
|
conf.add_section(sec11)
|
||||||
conf.set(sec11, "media_type",
|
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",
|
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"
|
sec12 = "watermark"
|
||||||
conf.add_section(sec12)
|
conf.add_section(sec12)
|
||||||
|
|||||||
4
core.py
4
core.py
@@ -521,7 +521,7 @@ def paste_file_to_folder(filepath, path, multi_part, number, part, leak_word, c_
|
|||||||
except:
|
except:
|
||||||
os.symlink(str(filepath_obj.resolve()), targetpath)
|
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('**/*'):
|
for subfile in filepath_obj.parent.glob('**/*'):
|
||||||
if subfile.is_file() and subfile.suffix.lower() in sub_res:
|
if subfile.is_file() and subfile.suffix.lower() in sub_res:
|
||||||
if multi_part and part.lower() not in subfile.name.lower():
|
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:
|
except:
|
||||||
os.symlink(str(filepath_obj.resolve()), targetpath)
|
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('**/*'):
|
for subfile in filepath_obj.parent.glob('**/*'):
|
||||||
if subfile.is_file() and subfile.suffix.lower() in sub_res:
|
if subfile.is_file() and subfile.suffix.lower() in sub_res:
|
||||||
if multi_part and part.lower() not in subfile.name.lower():
|
if multi_part and part.lower() not in subfile.name.lower():
|
||||||
|
|||||||
Reference in New Issue
Block a user