#!/usr/bin/perl -w
###############################
# 'cutstest.pl' (description: pings uk arts organisations' websites and reports)
# Copyright (C) 2008 Wayne Clements
#
# This program (but not the Script listed below, which is copyright of http://www.web-source.net) is free software:
# you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# See . #
#
#
# Wayne Clements, www.in-vacua.com. email: invacua_at__btinternet[Do T]com
#
###############################
use strict;
use warnings;
use Net::Ping;
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:all);
use HTTP::Date;
srand;
my %host = (
"www.access-space.org" => "Access Space",
"www.acme.org.uk" => "Acme Studios",
"www.actionspace.org" => "Action Space",
"www.afterall.org" => "Afterall",
"www.alchemyanew.co.uk" => "Alchemy Anew",
"www.a-n.co.uk" => "a-n",
"www.architecturecentre.net" => "Architecture Centre",
"www.arnolfini.org.uk" => "Arnolfini",
"www.artgene.co.uk" => "Art Gene",
"www.artmonthly.co.uk" => "Art Monthly",
"www.artangel.org.uk" => "Artangel",
"www.artlandish.org" => "Artlandish",
"www.spacestudios.org.uk" => "Art Services Grants",
"www.artpointtrust.org.uk" => "Artpoint",
"www.artsadmin.co.uk" => "Artsadmin",
"www.artsway.org.uk" => "Artsway Trust",
"www.aspex.org.uk" => "Aspex",
"www.avfestival.co.uk" => "Audio Visual Arts",
"www.axisweb.org" => "Axis",
"www.b3media.net" => "B3 Media",
"www.balticmill.com" => "Baltic Centre",
"www.beaconsfield.ltd.uk" => "Beaconsfield",
"www.beam.uk.net" => "Beam",
"www.bedfordcreativearts.org.uk" => "Bedford Creative Arts",
"www.bluecoatdisplaycentre.com" => "Bluecoat Display Centre",
"www.bookworks.org.uk" => "Book Works",
"www.chinese-arts-centre.org" => "Chinese Arts Centre",
"www.caa.org.uk" => "Contemporary Applied Arts",
"www.craftscouncil.org.uk" => "Crafts Council",
"www.craftspace.co.uk" => "Craftspace",
"www.crescentarts.co.uk" => "Crescent Arts",
"www.cubittartists.org.uk" => "Cubitt",
"www.dasharts.org" => "Dash",
"www.derbyquad.co.uk" => "Derby Quad",
"www.designedandmade.co.uk" => "Designed & Made",
"www.designermakerwm.co.uk" => "Designer Maker",
"www.electra-productions.com" => "Electra Productions",
"www.fourcornersfilm.co.uk" => "Four Corners",
"www.fvu.co.uk" => "Film and Video Umbrella",
"www.filmlondon.org.uk" => "Film London",
"www.folly.co.uk" => "Folly",
"www.forma.org.uk" => "Forma",
"www.grizedale.org" => "Grizedale Arts",
"www.heartnsoul.co.uk" => "Heart n Soul",
"www.hepworthwakefield.com" => "Hepworth Wakefield",
"www.photofest.org" => "Hereford Photography Festival",
"www.ikon-gallery.co.uk" => "Ikon Gallery",
"www.iniva.org" => "INIVA",
"www.isisarts.org.uk" => "Isis Arts",
"www.londondesignfestival.com" => "London Design Festival",
"www.kettlesyard.co.uk" => "Kettle's Yard Gallery",
"www.pva.org.uk" => "Labculture",
"www.lakelandartstrust.org.uk" => "Labculture",
"www.lighthouse.org.uk" => "Lighthouse Arts",
"www.thisisliveart.co.uk" => "Live Art",
"www.londonprintstudio.org.uk" => "London Print Studio",
"www.lovebytes.org.uk" => "Lovebytes",
"www.lumen.org.uk" => "Lumen",
"www.lux.org.uk" => "Lux",
"www.modernartoxford.org.uk" => "Modern Art Oxford",
"www.metamute.org" => "Mute",
"www.thenewartexchange.org.uk" => "New Art Exchange",
"www.thenewartgallerywalsall.org.uk" => "New Art Gallery Walsall",
"www.newcontemporaries.org.uk" => "New Contemporaries",
"www.northernprint.org.uk" => "Northern Print",
"www.nottinghamcontemporary.org" => "Nottingham Contemporary",
"www.broadway.org.uk" => "Nottingham Media Centre",
"www.onedotzero.com" => "onedotzero",
"www.openeyegallery.co.uk" => "Open Eye Gallery",
"www.pallant.org.uk" => "Pallant House Gallery",
"www.photonet.org.uk" => "Photographers' Gallery",
"www.plymouthartscentre.org" => "Plymouth Arts Centre",
"www.proboscis.org.uk" => "Proboscis",
"www.projectartworks.org" => "Project Art Works",
"www.quayarts.org" => "Quay Arts Centre",
"www.redeye.org.uk" => "Redeye",
"www.asiatriennialmanchester.com" => "Shisha",
"www.theshowroom.org" => "Showroom Gallery",
"www.artshub.co.uk"=> "Spacex",
"www.spike-island.org.uk" => "Spike Island",
"www.storeygallery.org.uk" => "Storey Gallery",
"www.stourvalleyarts.org.uk" => "Stour Valley Arts",
"www.sva.org.uk" => "Stroud Valleys Artspace",
"www.trianglearts.org" => "Triangle Arts",
"www.vane.org.uk" => "Vane Contemporary Art",
"www.vaga.co.uk" => "Visual Arts And Galleries",
"www.vivid.org.uk" => "Vivid",
"www.walfordmillcrafts.co.uk" => "Walford Mill",
"www.waygood.org" => "Waygood Gallery & Studios",
"www.watershed.co.uk" => "Watershed Arts Trust",
"www.the-ropewalk.co.uk" => "Waterside Artists Co-Operative",
"www.wypw.org" => "West Yorkshire Print Workshop",
"www.whitechapelgallery.org" => "Whitechapel Gallery",
"www.wolverhamptonart.org.uk" => "Wolverhampton Arts",
"www.wysingartscentre.org" => "Wysing Arts Centre",
"www.artspace.org.uk" => "Yorkshire Artspace",
);
my $chosen; my $key;
my $n = 0;
my($k, $v);
while(($k, $v) = each %host) {
rand(++$n) < 1 and $chosen = $v, $key = $k; ## 1 x random hash pair choice
}
print "Content-type: text/html\n\n";
my $html2 = "
cutstest
";
my $time;
my $string = time2str($time); ## gets time
my $p = Net::Ping->new("syn");
$p->{port_num} = getservbyname("http", "tcp");
$p->tcp_service_check(1);
$html2 =~ s/$chosen style=\"opacity: 0.1;\"/onload=\"makevisible(this,0)\"/ if $p->ping($key );
print $html2;
print "
CUTS_TEST:
$chosen...
...connection
is ";
$html2 =~ s/background=\".*?\"/background=\"blankimage.GIF\"/ unless $p->ping($key );
print " NOT! " unless $p->ping($key );
print "active
at $string\n
*
JavaScript enabled and Mozilla/Firefox browser required.
On smaller monitors this may not display correctly.
Refreshes every 5 secs and checks a new organisation.
Info page at project.arnolfini: here.
Thanks to Geoff Cox at project.arnolfini for his help on the project
";
##############
$p->close();
__END__