class Lolerrors::LinuxAdapter

Public Instance Methods

capture(message) click to toggle source
# File lib/lolerrors/adapters/linux_adapter.rb, line 3
def capture(message)
  Thread.new do
    puts 'Taking animated gif'
    %x( mkdir -p #{save_location} )
    %x( rm -vf #{video_file_path} #{gif_file_path} )
    create_gif_file
    make_caption message
    rename_gif
    puts 'Took gif successfully'
  end
end

Private Instance Methods

create_gif_file() click to toggle source
# File lib/lolerrors/adapters/linux_adapter.rb, line 17
def create_gif_file
  %x( ffmpeg -f v4l2 \
             -i /dev/video0 \
             -s 320x240 \
             -r 10 \
             -ss 0.7 \
             -to 3.7 \
             #{gif_file_path} )
end
make_caption(message) click to toggle source
# File lib/lolerrors/adapters/linux_adapter.rb, line 27
def make_caption(message)
  %x( convert #{gif_file_path} \
              -gravity South \
              -fill white \
              -stroke black \
              -strokewidth 1 \
              -pointsize 18 \
              -annotate +0+10 "! #{message}" \
              #{gif_file_path} )
end