af83

Simple like Hello 2012

If you are interested in how we made this year's new year greeting (which you can find here 2012.af83.com), here is a simplified architectural view:

Basically a simple Sinatra based server, serving the static content. When you submit the form it repeates the message on an irc channel using Cinch. There are two other IRC bots on the same channel, one is on the EEEpc controlling the Fux that Controls the Tux, which makes it speak and move. The other is on the laptop that is connected to the camera, adding the text from the IRC channel to the video which is then encoded and streamed to the Wowza which reencodes it for Flash and HTML5 video.

Sounds complicated?

Well it ain't, basically all of the server side code can be resumed to :

require 'cinch'
require 'sinatra'
require 'eventmachine'

set :public_directory, Proc.new { File.join(root, "public") }

get '/' do
 File.read(File.join('public', 'index.html'))
end

post '/form' do
  $bot.send("#af83-2012", "tux speak " + params[:message])
  $bot.send("#af83-2012", "tux mouth #{params[:message].split.size} close")
  $bot.send("#af83-2012", "tux flippers 2 down")
end

$bot = Cinch::Bot.new do
  configure do |c|
    c.server = "irc.freenode.org"
    c.channels = ["#af83-2012"]
    c.nick     = "TuxCamBot"
  end
end

EM::defer {
  $bot.start
}

blog comments powered by Disqus