class Cogibara::FileHandler

Public Instance Methods

convert_to_audio(file) click to toggle source
# File lib/cogibara/file_handler.rb, line 39
def convert_to_audio(file)

end
handle(file, clientID) click to toggle source
# File lib/cogibara/file_handler.rb, line 4
def handle(file, clientID)
  Responder.new.send_reply("@transcribe",clientID)
  handle_audio(file, clientID)
end
handle_audio(file, clientID, options={}) click to toggle source
# File lib/cogibara/file_handler.rb, line 9
def handle_audio(file, clientID, options={})
  if Cogibara::config.active_file_mode
    if Cogibara::dispatcher.registered_file?(Cogibara::config.active_file_mode)
      response = Cogibara::dispatcher.call_file(Cogibara::config.active_file_mode, file)
      Responder.new.send_reply(response,clientID)
    else
      puts "active file mode #{Cogibara::config.active_file_mode} enabled but not registered, doing the regular thing"
      newmessage = Message.new(Transcriber.new.transcribe(file), clientID)
      Responder.new.send_reply("you: #{newmessage.text}",clientID)
      Cogibara::message_handler.handle(newmessage)
    end
  else
    newmessage = Message.new(Transcriber.new.transcribe(file), clientID)
    Responder.new.send_reply("you: #{newmessage.text}",clientID)
    Cogibara::message_handler.handle(newmessage)
  end
end
handle_image(file) click to toggle source
# File lib/cogibara/file_handler.rb, line 31
def handle_image(file)
  "images not yet implemented"
end
handle_other(file) click to toggle source
# File lib/cogibara/file_handler.rb, line 35
def handle_other(file)
  "#{file} not supported"
end
handle_video(file) click to toggle source
# File lib/cogibara/file_handler.rb, line 27
def handle_video(file)

end