code: def file_to_subtitles(filename, encoding=None):
      """Converts a srt file into subtitles.
  
      The returned list is of the form ``[((start_time,end_time),'some text'),...]``
      and can be fed to SubtitlesClip.
  
      Only works for '.srt' format for the moment.
      """
      times_texts = []
      current_times = None
      current_text = ""
      with open(filename, "r", encoding=encoding) as file:
          for line in file:
              times = re.findall("([0-9]*:[0-9]*:[0-9]*,[0-9]*)", line)
              if times:
                  current_times = [convert_to_seconds(t) for t in times]
              elif line.strip() == "":
                  times_texts.append(
                      (current_times, current_text.strip("\n"))
                  )
                  current_times, current_text = None, ""
              elif current_times:
                  current_text += line
      return times_texts
  
file_path: moviepy/moviepy/video/tools/subtitles.py
imports: import re
  import numpy
  from moviepy.decorators import convert_path_to_string
  from moviepy.tools import convert_to_seconds
  from moviepy.video.VideoClip import TextClip, VideoClip
label_desc: Use image node_id 1 for calling a global function with example usage: file_to_subtitles(filename, encoding) and returns: times_texts