kevinwang676 commited on
Commit
ada57ff
1 Parent(s): 31eb529

Update app_share.py

Browse files
Files changed (1) hide show
  1. app_share.py +5 -5
app_share.py CHANGED
@@ -157,16 +157,16 @@ class subtitle:
157
  def normalize(self,ntype:str,fps=30):
158
  if ntype=="prcsv":
159
  h,m,s,fs=(self.start_time.replace(';',':')).split(":")#seconds
160
- self.start_time=int(h)*3600+int(m)*60+int(s)+round(int(fs)/fps,2)
161
  h,m,s,fs=(self.end_time.replace(';',':')).split(":")
162
- self.end_time=int(h)*3600+int(m)*60+int(s)+round(int(fs)/fps,2)
163
  elif ntype=="srt":
164
  h,m,s=self.start_time.split(":")
165
  s=s.replace(",",".")
166
- self.start_time=int(h)*3600+int(m)*60+round(float(s),2)
167
  h,m,s=self.end_time.split(":")
168
  s=s.replace(",",".")
169
- self.end_time=int(h)*3600+int(m)*60+round(float(s),2)
170
  else:
171
  raise ValueError
172
  def add_offset(self,offset=0):
@@ -265,7 +265,7 @@ def trim_audio(intervals, input_file_path, output_file_path):
265
 
266
  if len(segment) < 5000:
267
  # Calculate how many times to repeat the audio to make it at least 5 seconds long
268
- repeat_count = (5000 // len(segment)) + 5
269
  # Repeat the audio
270
  longer_audio = segment * repeat_count
271
  # Save the extended audio
 
157
  def normalize(self,ntype:str,fps=30):
158
  if ntype=="prcsv":
159
  h,m,s,fs=(self.start_time.replace(';',':')).split(":")#seconds
160
+ self.start_time=int(h)*3600+int(m)*60+int(s)+round(int(fs)/fps,5)
161
  h,m,s,fs=(self.end_time.replace(';',':')).split(":")
162
+ self.end_time=int(h)*3600+int(m)*60+int(s)+round(int(fs)/fps,5)
163
  elif ntype=="srt":
164
  h,m,s=self.start_time.split(":")
165
  s=s.replace(",",".")
166
+ self.start_time=int(h)*3600+int(m)*60+round(float(s),5)
167
  h,m,s=self.end_time.split(":")
168
  s=s.replace(",",".")
169
+ self.end_time=int(h)*3600+int(m)*60+round(float(s),5)
170
  else:
171
  raise ValueError
172
  def add_offset(self,offset=0):
 
265
 
266
  if len(segment) < 5000:
267
  # Calculate how many times to repeat the audio to make it at least 5 seconds long
268
+ repeat_count = (5000 // len(segment)) + 3
269
  # Repeat the audio
270
  longer_audio = segment * repeat_count
271
  # Save the extended audio