script to check if games are active

General discussion about Multiwinia

Moderators: jelco, bert_the_turtle

tiro
level1
level1
Posts: 29
Joined: Tue May 05, 2009 8:16 am

script to check if games are active

Postby tiro » Thu Sep 10, 2009 4:58 am

#!/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)"
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Postby xander » Thu Sep 10, 2009 6:13 am

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
tiro
level1
level1
Posts: 29
Joined: Tue May 05, 2009 8:16 am

Postby tiro » Thu Sep 10, 2009 6:43 am

Yes but I rigged my script to make annoying noises when games are available.
User avatar
xyzyxx
level5
level5
Posts: 3790
Joined: Wed Jul 02, 2003 7:50 pm
Location: Iowa, USA
Contact:

Postby xyzyxx » Thu Sep 10, 2009 6:42 pm

That sounds... annoying.
Some people talk because they have something to say. Others talk because they have to say something.

Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest