X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=parse%2Fparse-ccbs-playerlist.pl;fp=parse%2Fparse-ccbs-playerlist.pl;h=d6a141ffdd233fef300ec88cc873b14963cc82ef;hb=219fa45b3f74548ab201100db64132d9f7b24344;hp=0000000000000000000000000000000000000000;hpb=c76af731cb57536c8dd6433f1c6418a7906bdd41;p=ccbs 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";