modify scripts
This commit is contained in:
@ -109,6 +109,17 @@ def sync_whisper_to_stash(whisper_db_path, stash_db_path, dir_prefix, studio_fil
|
|||||||
matched = False
|
matched = False
|
||||||
for whisper_code, whisper_row in idx_whisper.items():
|
for whisper_code, whisper_row in idx_whisper.items():
|
||||||
if whisper_code and basename and str(whisper_code).lower() in basename.lower():
|
if whisper_code and basename and str(whisper_code).lower() in basename.lower():
|
||||||
|
# 尝试对 basename 进行截取,从匹配到 whisper_code 的位置开始截取,一直遇到非字母和数字的字符为止
|
||||||
|
start_index = basename.lower().find(str(whisper_code).lower())
|
||||||
|
end_index = start_index + len(whisper_code)
|
||||||
|
# 向后扩展,直到遇到非字母数字字符
|
||||||
|
while end_index < len(basename) and basename[end_index].isalnum():
|
||||||
|
end_index += 1
|
||||||
|
extracted_code = basename[start_index:end_index]
|
||||||
|
if extracted_code.lower() != str(whisper_code).lower():
|
||||||
|
# 截取结果与whisper_code不匹配,跳过
|
||||||
|
continue
|
||||||
|
|
||||||
# 找到匹配项,更新stash数据库
|
# 找到匹配项,更新stash数据库
|
||||||
matched = True
|
matched = True
|
||||||
matched_cnt += 1
|
matched_cnt += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user