]> git.sesse.net Git - ccbs/blob - parse/parse-ccbs-playerlist.pl
There is no freshcolumnheading.
[ccbs] / parse / parse-ccbs-playerlist.pl
1 #! /usr/bin/perl
2 use strict;
3 use warnings;
4 use Date::Manip;
5
6 # Parses players from our own HTML, to get the clubs and nationalities right.
7
8 print "begin;\n";
9
10 while (<>) {
11         if (/^ \s* <td><a \s* href=".*\/player\.pl\?id=\d+"> (.*?) <\/a><\/td> \s* $/x) {
12                 my $nick = $1;
13         
14                 chomp ($_ = <>);
15                 /<td> (.*?) <\/td>/x or die;
16                 my $country = $1;
17         
18                 chomp ($_ = <>);
19                 /<td> (.*?) <\/td>/x or die;
20                 my $club = $1;
21
22                 print "UPDATE players SET\n";
23                 print "  country=(SELECT country FROM countries WHERE countryname='$country'),\n";
24                 print "  club=(SELECT club FROM clubs WHERE clubname='$club') WHERE nick='$nick';\n";
25         }
26 }
27
28 printf "commit;\n";