warn "Error in parsing PGN from $url\n";
} else {
eval {
+ # Skip to the right game.
+ while (defined($remoteglotconf::pgn_filter) &&
+ !&$remoteglotconf::pgn_filter($pgn)) {
+ $pgn->read_game() or die "Out of games during filtering";
+ }
+
$pgn->parse_game({ save_comments => 'yes' });
my $pos = Position->start_pos($pgn->white, $pgn->black);
my $moves = $pgn->moves;
}
};
if ($@) {
- warn "Error in parsing moves from $url\n";
+ warn "Error in parsing moves from $url: $@\n";
}
}
if (exists($comments->{$white_key}) &&
exists($comments->{$black_key}) &&
- $comments->{$white_key} =~ /tl=(\d+:\d+:\d+)/ &&
- $comments->{$black_key} =~ /tl=(\d+:\d+:\d+)/) {
- $comments->{$white_key} =~ /tl=(\d+:\d+:\d+)/;
+ $comments->{$white_key} =~ /(?:tl=|clk )(\d+:\d+:\d+)/ &&
+ $comments->{$black_key} =~ /(?:tl=|clk )(\d+:\d+:\d+)/) {
+ $comments->{$white_key} =~ /(?:tl=|clk )(\d+:\d+:\d+)/;
$pos->{'white_clock'} = $1;
- $comments->{$black_key} =~ /tl=(\d+:\d+:\d+)/;
+ $comments->{$black_key} =~ /(?:tl=|clk )(\d+:\d+:\d+)/;
$pos->{'black_clock'} = $1;
+
+ $pos->{'white_clock'} =~ s/\b(\d)\b/0$1/g;
+ $pos->{'black_clock'} =~ s/\b(\d)\b/0$1/g;
return;
}
+
+ delete $pos->{'white_clock'};
+ delete $pos->{'black_clock'};
}
sub find_clock_start {
}
# TODO(sesse): Maybe we can get the number of moves somehow else for FICS games.
+ # The history is needed for id_for_pos.
if (!exists($pos->{'pretty_history'})) {
return;
}