Skip to content

Commit

Permalink
fix: add fault tolerance (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
timerring authored Dec 14, 2024
1 parent c92488a commit 5d5cdc5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/record.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Traceback (most recent call last):
[2024-11-22 14:29:04,305] [CRITICAL] [exception_handler] KeyError
```

通常是短时间内添加次数过多,api 请求限制了,可以等几分钟再添加,也可以打开 port 对应面板后在面板里手动添加。
通常是短时间内添加该房间次数过多,api 请求限制了,可以等几分钟再添加该房间,也可以打开 port 对应面板后在面板里手动添加。

## 已经在录制状态,重启项目又无法正常工作

Expand Down
15 changes: 11 additions & 4 deletions src/burn/only_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ def render_video_only(video_path):

# Recoginze the resolution of video
video_resolution = get_resolution(original_video_path)

# Process the danmakus to ass and remove emojis
subtitle_font_size, subtitle_margin_v = process_danmakus(xml_path, video_resolution)
try:
# Process the danmakus to ass and remove emojis
subtitle_font_size, subtitle_margin_v = process_danmakus(xml_path, video_resolution)
except TypeError as e:
print(f"TypeError: {e} - Check the return value of process_danmakus")
except FileNotFoundError as e:
print(f"FileNotFoundError: {e} - Check if the file exists")

# Generate the srt file via whisper model
if GPU_EXIST:
Expand Down Expand Up @@ -67,7 +71,10 @@ def monitor_queue(self):
while True:
if not self.render_queue.empty():
video_path = self.render_queue.get()
render_video_only(video_path)
try:
render_video_only(video_path)
except Exception as e:
print(f"Error processing video {video_path}: {e}", flush=True)
else:
time.sleep(1)

Expand Down

0 comments on commit 5d5cdc5

Please sign in to comment.