DWizard commited on
Commit
eb01d5d
·
1 Parent(s): 393add1

preprocess function

Browse files

Former-commit-id: 00c894898f81217365d143f12cfaef717d68639c

Files changed (1) hide show
  1. src/task.py +10 -1
src/task.py CHANGED
@@ -8,6 +8,8 @@ from pathlib import Path
8
  from enum import Enum, auto
9
  import logging
10
  import subprocess
 
 
11
 
12
 
13
 
@@ -98,13 +100,20 @@ class Task:
98
  def get_srt_class(self, whisper_model='tiny', method="stable"):
99
  # Instead of using the script_en variable directly, we'll use script_input
100
  self.status = TaskStatus.INITIALIZING_ASR
 
101
  time.sleep(5)
102
  pass
103
 
104
  # Module 2: SRT preprocess: perform preprocess steps
105
  def preprocess(self):
106
  self.status = TaskStatus.PRE_PROCESSING
107
- time.sleep(5)
 
 
 
 
 
 
108
  pass
109
 
110
  def update_translation_progress(self, new_progress):
 
8
  from enum import Enum, auto
9
  import logging
10
  import subprocess
11
+ from src.srt_util.srt import SrtScript
12
+ from src.srt_util.srt2ass import srt2ass
13
 
14
 
15
 
 
100
  def get_srt_class(self, whisper_model='tiny', method="stable"):
101
  # Instead of using the script_en variable directly, we'll use script_input
102
  self.status = TaskStatus.INITIALIZING_ASR
103
+ self.SRT_Script = SrtScript
104
  time.sleep(5)
105
  pass
106
 
107
  # Module 2: SRT preprocess: perform preprocess steps
108
  def preprocess(self):
109
  self.status = TaskStatus.PRE_PROCESSING
110
+ self.SRT_Script.form_whole_sentence()
111
+ self.SRT_Script.correct_with_force_term()
112
+ self.SRT_Script.write_srt_file_src(str(Path(self.task_local_dir).with_suffix(""))+"_processed.srt")
113
+
114
+ if not self.launch_info.srt_only:
115
+ assSub_en = srt2ass()
116
+ self.script_input = self.SRT_Script.get_source_only()
117
  pass
118
 
119
  def update_translation_progress(self, new_progress):