<commit_before>module CutCut
  # Media
  class Timelapse < Base
    def initialize(options = {})
      @input = options[:input]
      @output = options[:output]
    end

    def files
      Dir.glob(File.join(input, '*.JPG'))
    end

    def basenames
      files.map { |e| File.basename(e, '.JPG').to_s }
    end

    def common_substring
      Helpers.longest_common_substring(*basenames)
    end

    def start_number
      basenames.first.gsub(common_substring, '')
    end

    def input_basename
      common_substring + "#{start_number.chars.count}%d.JPG"
    end

    def convert(options = {})
      fps = options[:fps] || 30
      execute_ffmpeg_command(
        input_file: input_file,
        output_file: "#{output_path}/out.mp4",
        raw_options: "-f image2  -start_number 036 -framerate #{fps} c:v libx264 -r 30 -pix_fmt yuv420p"
      )
    end<commit_msg>Update timelapse to use new fields<commit_after>module CutCut
  # Media
  class Timelapse < Base
    def initialize(options = {})
      @input = options[:input]
      @output = options[:output]
    end

    def files
      Dir.glob(File.join(input, '*.JPG'))
    end

    def basenames
      files.map { |e| File.basename(e, '.JPG').to_s }
    end

    def common_substring
      Helpers.longest_common_substring(*basenames)
    end

    def start_number
      basenames.first.gsub(common_substring, '')
    end

    def input_basename
      common_substring + "#{start_number.chars.count}%d.JPG"
    end

    def convert(options = {})
      fps = options[:fps] || 30
      execute_ffmpeg_command(
        input_file: File.join(@input, input_basename),
        output_file: @output,
        raw_options: "-f image2  -start_number #{start_number} -framerate #{fps} c:v libx264 -r 30 -pix_fmt yuv420p"
      )
    end
{'fraction_non_alphanumeric': 0.11390284757118928, 'fraction_numerical': 0.014517029592406477, 'mean_word_length': 2.584, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '776751', 'n_tokens_mistral': 634, 'n_tokens_neox': 605, 'n_words': 129}