From: Steinar H. Gunderson Date: Thu, 9 Feb 2012 22:20:15 +0000 (+0100) Subject: Add a script to parse the CCBS player list and set countries and clubs correctly. X-Git-Url: https://git.sesse.net/?p=ccbs;a=commitdiff_plain;h=219fa45b3f74548ab201100db64132d9f7b24344 Add a script to parse the CCBS player list and set countries and clubs correctly. --- diff --git a/parse/parse-ccbs-playerlist.pl b/parse/parse-ccbs-playerlist.pl new file mode 100644 index 0000000..d6a141f --- /dev/null +++ b/parse/parse-ccbs-playerlist.pl @@ -0,0 +1,28 @@ +#! /usr/bin/perl +use strict; +use warnings; +use Date::Manip; + +# Parses players from our own HTML, to get the clubs and nationalities right. + +print "begin;\n"; + +while (<>) { + if (/^ \s* (.*?) <\/a><\/td> \s* $/x) { + my $nick = $1; + + chomp ($_ = <>); + / (.*?) <\/td>/x or die; + my $country = $1; + + chomp ($_ = <>); + / (.*?) <\/td>/x or die; + my $club = $1; + + print "UPDATE players SET\n"; + print " country=(SELECT country FROM countries WHERE countryname='$country'),\n"; + print " club=(SELECT club FROM clubs WHERE clubname='$club') WHERE nick='$nick';\n"; + } +} + +printf "commit;\n";