Merge pull request #132 from yubanmeiqin9048/re

This commit is contained in:
jxxghp 2023-08-16 10:22:12 +08:00 committed by GitHub
commit 9bb803abfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,11 +122,11 @@ class FileTransferModule(_ModuleBase):
r"|chinese|(cn|ch[si]|sg|zho?|eng)[-_&](cn|ch[si]|sg|zho?|eng)" \ r"|chinese|(cn|ch[si]|sg|zho?|eng)[-_&](cn|ch[si]|sg|zho?|eng)" \
r"|简[体中]?)[.\])])" \ r"|简[体中]?)[.\])])" \
r"|([\u4e00-\u9fa5]{0,3}[中双][\u4e00-\u9fa5]{0,2}[字文语][\u4e00-\u9fa5]{0,3})" \ r"|([\u4e00-\u9fa5]{0,3}[中双][\u4e00-\u9fa5]{0,2}[字文语][\u4e00-\u9fa5]{0,3})" \
r"|简体|简中" \ r"|简体|简中|JPSC" \
r"|(?<![a-z0-9])gb(?![a-z0-9])" r"|(?<![a-z0-9])gb(?![a-z0-9])"
_zhtw_sub_re = r"([.\[(](((zh[-_])?(hk|tw|cht|tc))" \ _zhtw_sub_re = r"([.\[(](((zh[-_])?(hk|tw|cht|tc))" \
r"|繁[体中]?)[.\])])" \ r"|繁[体中]?)[.\])])" \
r"|繁体中[文字]|中[文字]繁体|繁体" \ r"|繁体中[文字]|中[文字]繁体|繁体|JPTC" \
r"|(?<![a-z0-9])big5(?![a-z0-9])" r"|(?<![a-z0-9])big5(?![a-z0-9])"
_eng_sub_re = r"[.\[(]eng[.\])]" _eng_sub_re = r"[.\[(]eng[.\])]"
@ -162,12 +162,12 @@ class FileTransferModule(_ModuleBase):
continue continue
new_file_type = "" new_file_type = ""
# 兼容jellyfin字幕识别(多重识别), emby则会识别最后一个后缀 # 兼容jellyfin字幕识别(多重识别), emby则会识别最后一个后缀
if re.search(_zhcn_sub_re, file_item.stem, re.I): if re.search(_zhcn_sub_re, file_item.name, re.I):
new_file_type = ".chi.zh-cn" new_file_type = ".chi.zh-cn"
elif re.search(_zhtw_sub_re, file_item.stem, elif re.search(_zhtw_sub_re, file_item.name,
re.I): re.I):
new_file_type = ".zh-tw" new_file_type = ".zh-tw"
elif re.search(_eng_sub_re, file_item.stem, re.I): elif re.search(_eng_sub_re, file_item.name, re.I):
new_file_type = ".eng" new_file_type = ".eng"
# 通过对比字幕文件大小 尽量转移所有存在的字幕 # 通过对比字幕文件大小 尽量转移所有存在的字幕
file_ext = file_item.suffix file_ext = file_item.suffix