kemuriririn commited on
Commit
b6ca400
·
1 Parent(s): b326d08

(wip)update file cache pipeline

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -738,12 +738,6 @@ def generate_tts():
738
  if reference_audio_path and os.path.exists(reference_audio_path):
739
  os.remove(reference_audio_path)
740
 
741
- # 计算prompt_md5用于后续判断
742
- prompt_md5 = ''
743
- if reference_audio_path and os.path.exists(reference_audio_path):
744
- with open(reference_audio_path, 'rb') as f:
745
- prompt_md5 = hashlib.md5(f.read()).hexdigest()
746
-
747
  # Check if text and prompt are in predefined libraries
748
  if text in predefined_texts and prompt_md5 in predefined_prompts.values():
749
  with preload_cache_lock:
@@ -1175,6 +1169,8 @@ def setup_periodic_tasks():
1175
  # 增量覆盖:逐个文件对比md5,有diff才覆盖
1176
  for root, _, files in os.walk(temp_unzip_dir):
1177
  for fname in files:
 
 
1178
  rel_path = os.path.relpath(os.path.join(root, fname), temp_unzip_dir)
1179
  src_file = os.path.join(root, fname)
1180
  dst_file = os.path.join(PRELOAD_CACHE_DIR, rel_path)
 
738
  if reference_audio_path and os.path.exists(reference_audio_path):
739
  os.remove(reference_audio_path)
740
 
 
 
 
 
 
 
741
  # Check if text and prompt are in predefined libraries
742
  if text in predefined_texts and prompt_md5 in predefined_prompts.values():
743
  with preload_cache_lock:
 
1169
  # 增量覆盖:逐个文件对比md5,有diff才覆盖
1170
  for root, _, files in os.walk(temp_unzip_dir):
1171
  for fname in files:
1172
+ if fname.startswith("._"): # 忽略macOS的资源分支文件
1173
+ continue
1174
  rel_path = os.path.relpath(os.path.join(root, fname), temp_unzip_dir)
1175
  src_file = os.path.join(root, fname)
1176
  dst_file = os.path.join(PRELOAD_CACHE_DIR, rel_path)