AlbertoFH98 commited on
Commit
bdf4f77
·
verified ·
1 Parent(s): 47781f9

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +3 -3
utils.py CHANGED
@@ -467,17 +467,17 @@ def time_to_seconds(time_str):
467
  def add_hyperlink_and_convert_to_seconds(text):
468
  time_pattern = r'(\d{2}:\d{2}:\d{2}(?:.\d{6})?)'
469
 
470
- def get_seconds(match):
471
  if len(match) == 2:
472
  start_time_str, end_time_str = match[0], match[1]
473
  else:
474
  start_time_str = match[0]
475
- end_time_str = re.findall(r"Desde el instante {} hasta {}".format(start_time_str, time_pattern))[0].split('hasta ')[-1]
476
 
477
  start_time_seconds = time_to_seconds(start_time_str)
478
  end_time_seconds = time_to_seconds(end_time_str)
479
  return start_time_str, start_time_seconds, end_time_str, end_time_seconds
480
- start_time_str, start_time_seconds, end_time_str, end_time_seconds = get_seconds(re.findall(time_pattern, text))
481
  return start_time_str, start_time_seconds, end_time_str, end_time_seconds
482
 
483
  # -- Streamlit HTML template
 
467
  def add_hyperlink_and_convert_to_seconds(text):
468
  time_pattern = r'(\d{2}:\d{2}:\d{2}(?:.\d{6})?)'
469
 
470
+ def get_seconds(match, text):
471
  if len(match) == 2:
472
  start_time_str, end_time_str = match[0], match[1]
473
  else:
474
  start_time_str = match[0]
475
+ end_time_str = re.findall(r"Desde el instante {} hasta {}".format(start_time_str, time_pattern), text)[0].split('hasta ')[-1]
476
 
477
  start_time_seconds = time_to_seconds(start_time_str)
478
  end_time_seconds = time_to_seconds(end_time_str)
479
  return start_time_str, start_time_seconds, end_time_str, end_time_seconds
480
+ start_time_str, start_time_seconds, end_time_str, end_time_seconds = get_seconds(re.findall(time_pattern, text), text)
481
  return start_time_str, start_time_seconds, end_time_str, end_time_seconds
482
 
483
  # -- Streamlit HTML template