Merge pull request #27 from Quasimondo/main

Update font2img_node.py
This commit is contained in:
Pascal Rössler
2024-05-29 20:29:05 +02:00
committed by GitHub
+4 -2
View File
@@ -67,6 +67,7 @@ class font2img:
"optional": {
"transcription": ("TRANSCRIPTION", {"default": None,"forceInput": True}),
"highlight_font": ("TEXT_GRAPHIC_ELEMENT", {"default": None,"forceInput": True}),
"skip_first_frames": ("INT", {"default": 0, "min": 0, "step": 1, "display": "number"}),
}
}
@@ -660,7 +661,8 @@ class font2img:
structured_format = False
frame_text_dict = {}
frame_count = kwargs['frame_count']
skip_first_frames = kwargs.get('skip_first_frames', 0)
# Filter out empty lines
lines = [line for line in text.split('\n') if line.strip()]
@@ -670,7 +672,7 @@ class font2img:
for line in lines:
parts = line.split(':', 1)
if len(parts) == 2:
frame_number = parts[0].strip().replace('"', '')
frame_number = str(int(parts[0].strip().replace('"', ''))-skip_first_frames)
text = parts[1].strip().replace('"', '').replace(',', '')
frame_text_dict[frame_number] = text
else: