Update main_process/salamandra_router.py
Browse files
main_process/salamandra_router.py
CHANGED
|
@@ -985,6 +985,19 @@ class Valoracion_Final:
|
|
| 985 |
|
| 986 |
return state
|
| 987 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 988 |
class Free_Narration:
|
| 989 |
def __call__(self, state: NState, audio_descripcion_path_sin_une, story_path) -> NState:
|
| 990 |
|
|
|
|
| 985 |
|
| 986 |
return state
|
| 987 |
|
| 988 |
+
def extract_text_from_srt(srt_path):
|
| 989 |
+
with open(srt_path, 'r', encoding='utf-8') as f:
|
| 990 |
+
content = f.read()
|
| 991 |
+
|
| 992 |
+
content = re.sub(r'^\d+\s*$', '', content, flags=re.MULTILINE)
|
| 993 |
+
|
| 994 |
+
content = re.sub(r'^\d{2}:\d{2}:\d{2},\d{3} --> .*$', '', content, flags=re.MULTILINE)
|
| 995 |
+
|
| 996 |
+
lines = [line.strip() for line in content.splitlines() if line.strip()]
|
| 997 |
+
|
| 998 |
+
text = "\n".join(lines)
|
| 999 |
+
return text
|
| 1000 |
+
|
| 1001 |
class Free_Narration:
|
| 1002 |
def __call__(self, state: NState, audio_descripcion_path_sin_une, story_path) -> NState:
|
| 1003 |
|