module FFmpegProgress::Utils

Helper methods.

Constants

BELL

The bell file to be used to signal completion.

Public Instance Methods

bell() click to toggle source

Play the bell sound.

@return [Integer] the PID of the bell process.

# File lib/ffmpeg_progress/utils.rb, line 11
def bell
  ffplay =
    spawn "ffplay -nodisp -autoexit '#{BELL}' &> /dev/null"
  Process.detach(ffplay)
  ffplay
end
parse_ffmpeg_time(time_string) click to toggle source

Parse a time string in the ffmpeg HH:MM:SS.ms format and return seconds.

@param [String] time_string @return [Integer]

# File lib/ffmpeg_progress/utils.rb, line 23
def parse_ffmpeg_time(time_string)
  array = time_string.rpartition('.').first.split(':').map(&:to_i)

  array[0] * 3600 + array[1] * 60 + array[2]
end