You've already forked FrameTour-RenderWorker
Compare commits
2 Commits
ca9093504f
...
9158854411
| Author | SHA1 | Date | |
|---|---|---|---|
| 9158854411 | |||
| 634dc6c855 |
@@ -127,9 +127,9 @@ class FinalizeMp4Handler(BaseHandler):
|
|||||||
concat_file = os.path.join(work_dir, 'concat.txt')
|
concat_file = os.path.join(work_dir, 'concat.txt')
|
||||||
with open(concat_file, 'w', encoding='utf-8') as f:
|
with open(concat_file, 'w', encoding='utf-8') as f:
|
||||||
for ts_file in ts_files:
|
for ts_file in ts_files:
|
||||||
# 路径中的反斜杠需要转义或使用正斜杠
|
# FFmpeg concat 路径相对于 concat.txt 所在目录,只需写文件名
|
||||||
ts_path = ts_file.replace('\\', '/')
|
ts_filename = os.path.basename(ts_file)
|
||||||
f.write(f"file '{ts_path}'\n")
|
f.write(f"file '{ts_filename}'\n")
|
||||||
|
|
||||||
# 3. 构建合并命令(remux,不重编码)
|
# 3. 构建合并命令(remux,不重编码)
|
||||||
cmd = [
|
cmd = [
|
||||||
|
|||||||
@@ -292,6 +292,14 @@ class MaterialCache:
|
|||||||
for file_info in cache_files:
|
for file_info in cache_files:
|
||||||
if total_size <= target_size:
|
if total_size <= target_size:
|
||||||
break
|
break
|
||||||
|
# 从文件名提取 cache_key,检查是否有锁(说明正在被使用)
|
||||||
|
filename = os.path.basename(file_info['path'])
|
||||||
|
cache_key = os.path.splitext(filename)[0]
|
||||||
|
lock_path = self._get_lock_path(cache_key)
|
||||||
|
if os.path.exists(lock_path):
|
||||||
|
# 该文件正在被其他任务使用,跳过删除
|
||||||
|
logger.debug(f"Cache cleanup: skipping locked file {filename}")
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
os.remove(file_info['path'])
|
os.remove(file_info['path'])
|
||||||
total_size -= file_info['size']
|
total_size -= file_info['size']
|
||||||
|
|||||||
Reference in New Issue
Block a user