Page 1 of 1

script to check if games are active

Posted: Thu Sep 10, 2009 4:58 am
by tiro
#!/usr/bin/env ruby

require 'rubygems'
require 'mechanize'
require 'nokogiri'

mech = WWW::Mechanize.new
mech.get('http://www.multiwinia-ladder.net/externalgip.php')
doc = Nokogiri(mech.page.body)

games_with_players = doc.search('server').select { |xml_element| xml_element.at('players').inner_text.to_i > 1}
games_waiting = games_with_players.select { |xml_element| xml_element.at('status').inner_text == 'Waiting'}

puts "Games with players: #{games_with_players.length} (#{games_waiting.length} waiting)"

Posted: Thu Sep 10, 2009 6:13 am
by xander
http://www.multiwinia-ladder.net/gamesinprogress.php ?

Also, there are widgets for both Firefox and Opera hosted on the ladder website, which may duplicate much of the functionality that you are looking for.

xander

Posted: Thu Sep 10, 2009 6:43 am
by tiro
Yes but I rigged my script to make annoying noises when games are available.

Posted: Thu Sep 10, 2009 6:42 pm
by xyzyxx
That sounds... annoying.