God bless BBC Radio Labs. They get to build some cool little things including a fun little XMPP server. Its pushing out messages that usually only get seen on the front of DAB radios. I whipped this ruby script together pretty quick (you can tell), but shows how easy you can connect to it.
require 'rubygems'
require 'ruby-growl'
require 'xmpp4r-simple'
username = 'myusername'
password = 'password'
domain = 'hug.hellomatty.com'
im = Jabber::Simple.new("#{username}@#{domain}", password)
im.status(:chat, 'Hello world')
g = Growl.new "localhost", "ruby-growl", ["ruby-growl Notification"], nil, "growl"
i = 0
while true
i+=1
if im.connected? == true
im.presence_updates.each do |friend, old_presence, new_presence|
if new_presence != nil
puts "#{friend.gsub("@#{domain}", '')} #{new_presence}"
g.notify("ruby-growl Notification", friend.gsub("@#{domain}", ''), new_presence)
end
end
else
puts '**************************** disconnected *************************'
im = Jabber::Simple.new("#{username}@#{domain}", password)
im.status(:chat, 'Hello world')
end
sleep(2)
if i == 10
im.reconnect
i = 0
end
end
Here is some sample output.
radio3: Details from bbc.co.uk/radio3 or call 08700 100 300.
1xtra: 1Xtra Dancehall Show - Robbo Ranx. Txt 88111 [network rates apply].
radio4: The World Tonight. Web - bbc.co.uk/news
radio2: Mark Lamarr. Mark presents the Shake, Rattle and Roll Show.
5live: Richard Bacon: Lively and provocative discussion regarding the day's key stories
Now I have no idea what I can do with this (twitter posting is already done to death), so I might have a think about this sort of thing. Be fun if it makes it into production.