From 64bb65f65e37dbc157d3dd09b47de8a5da7d3690 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 13 Feb 2005 17:08:57 +0000 Subject: [PATCH] Add the beginnings of a script for converting from the DDREurope result lists. --- parse/parse-ddreurope-tournament.pl | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 parse/parse-ddreurope-tournament.pl diff --git a/parse/parse-ddreurope-tournament.pl b/parse/parse-ddreurope-tournament.pl new file mode 100644 index 0000000..ccee272 --- /dev/null +++ b/parse/parse-ddreurope-tournament.pl @@ -0,0 +1,41 @@ +#! /usr/bin/perl +use strict; +use warnings; +use Date::Manip; + +# Parses tournament results from the DDR Europe result list + +my $season = shift; +my $name; +die "Missing season (give on command line)." if (!defined($season)); + +print "begin;\n"; + +while (<>) { + if (/

\s* (.*?) \s* <\/h2>/x) { + $name = $1; + next; + } + if (/
Country: \s* (.*?) \s* +
Location: \s* (.*?) \s* +
Date: \s* (.*?) \s* +
Mix: \s* (.*?) \s* +
ScoringSystem: \s* (.*?) \s*
+ /x) { + my ($country, $location, $date, $mix, $system) = ($1, $2, $3, $4, $5); + $mix =~ s/Euromix/EuroMix/; + + print "INSERT INTO tournaments \n"; + print " (season, name, country, location, \"date\", machine, scoringsystem) VALUES (\n"; + print " (SELECT season FROM seasons WHERE name='$season'),\n"; + print " '$name',\n"; + print " (SELECT country FROM countries WHERE name='$country'),\n"; + print " '$location',\n"; + printf " '%s',\n", Date::Manip::UnixDate($date, '%Y-%m-%d'); + print " (SELECT machine FROM machines WHERE name='$mix'),\n"; + print " (SELECT scoringsystem FROM scoringsystems WHERE name='$system')\n"; + print ");\n"; + } +} + +printf "commit;\n"; -- 2.39.2