X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=parse%2Fparse-ddreurope-tournament.pl;h=b0da713c3ad7523610a6395807122a396867d928;hp=5773f13648428f863d5d2e7953573683cc873a78;hb=4ddc2d1937960d5cf4017644a41433eac2f6f391;hpb=aee1f77ca1957086ed876b49e1b5e4f744eef2f2 diff --git a/parse/parse-ddreurope-tournament.pl b/parse/parse-ddreurope-tournament.pl index 5773f13..b0da713 100644 --- a/parse/parse-ddreurope-tournament.pl +++ b/parse/parse-ddreurope-tournament.pl @@ -140,6 +140,32 @@ while (<>) { print " round=$round;\n"; } + # First place + if (/A \s* well-earned \s* victory \s* for .*? class="link"> (.*?) <\/a> (?: , \s* who \s* got \s* (\d+) \s* point )?/x) { + my $nick = $1; + my $points = $2; + + # Whoa :-) + $points = 'NULL' unless defined($points); + + print "INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (\n"; + print " (SELECT tournament FROM tournaments WHERE tournamentname='$name'),\n"; + print " 1, '$nick', $points);\n"; + } + + # All other places + while (s/(\d+) (?: st | nd | rd | th ) \s* place: .*? class="link"> (.*?) <\/a> \s* (?: got \s* (\d+) \s* point )?//x) { + my $ranking = $1; + my $nick = $2; + my $points = $3; + + # Whoa :-) + $points = 'NULL' unless defined($points); + + print "INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (\n"; + print " (SELECT tournament FROM tournaments WHERE tournamentname='$name'),\n"; + print " $ranking, '$nick', $points);\n"; + } } printf "commit;\n";