Skip to content

Commit 5d5cdc5

Browse files
authored
fix: add fault tolerance (#137)
1 parent c92488a commit 5d5cdc5

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

docs/record.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Traceback (most recent call last):
5050
[2024-11-22 14:29:04,305] [CRITICAL] [exception_handler] KeyError
5151
```
5252

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

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

src/burn/only_render.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ def render_video_only(video_path):
3131

3232
# Recoginze the resolution of video
3333
video_resolution = get_resolution(original_video_path)
34-
35-
# Process the danmakus to ass and remove emojis
36-
subtitle_font_size, subtitle_margin_v = process_danmakus(xml_path, video_resolution)
34+
try:
35+
# Process the danmakus to ass and remove emojis
36+
subtitle_font_size, subtitle_margin_v = process_danmakus(xml_path, video_resolution)
37+
except TypeError as e:
38+
print(f"TypeError: {e} - Check the return value of process_danmakus")
39+
except FileNotFoundError as e:
40+
print(f"FileNotFoundError: {e} - Check if the file exists")
3741

3842
# Generate the srt file via whisper model
3943
if GPU_EXIST:
@@ -67,7 +71,10 @@ def monitor_queue(self):
6771
while True:
6872
if not self.render_queue.empty():
6973
video_path = self.render_queue.get()
70-
render_video_only(video_path)
74+
try:
75+
render_video_only(video_path)
76+
except Exception as e:
77+
print(f"Error processing video {video_path}: {e}", flush=True)
7178
else:
7279
time.sleep(1)
7380

0 commit comments

Comments
 (0)