From 219fa45b3f74548ab201100db64132d9f7b24344 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 9 Feb 2012 23:20:15 +0100 Subject: [PATCH] Add a script to parse the CCBS player list and set countries and clubs correctly. --- parse/parse-ccbs-playerlist.pl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 parse/parse-ccbs-playerlist.pl 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"; -- 2.39.2