Commit 64819cc7 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

efa: Code cleanup

parent 6b5ac125
Loading
Loading
Loading
Loading
+31 −34
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ my $walk_speed;
my $with_bike;
my $debug = 0;
my $ignore_info = 'Fahrradmitnahme';
my ($i, $j, $con, $part);

sub check_ambiguous {
	my $html = shift;
@@ -57,17 +56,15 @@ sub check_ambiguous {
sub parse_content {
	my $raw = shift;
	my $groupsize = 8;
	my $offset;
	my $return;
	my @extra;
	for (my $offer = 0; exists($raw->[$offer]); $offer++) {
		foreach (@{$raw->[$offer]}) {
			s/\s* <br> \s*/, /gx;
			s/< [^>]+ >//gx;
		}
		for (my $i = 0; @{$raw->[$offer]} >= (($i+1) * $groupsize) - 1; $i++) {
			$offset = $i * $groupsize;
			undef(@extra);
			my $offset = $i * $groupsize;
			my @extra;
			if ($raw->[$offer]->[$offset+2] =~ /^(Fußweg | Anschluss \s wird .* abgewartet)/x) {
				# These are generic, which means they don't contain a time
				splice(@{$raw->[$offer]}, $offset, 0, '');
@@ -212,7 +209,7 @@ if (@exclude) {
			when ('ast')    { $post{inclMOT_10} = undef }
			when ('sonstige') {$post{inclMOT_11} = undef }
			default {
				print STDERR "--exclude: invalid argument\n";
				print STDERR "--exclude: invalid argument '$_'\n";
			}
		}
	}
@@ -283,9 +280,9 @@ if ($debug) {
		print STDERR "\t$_ => $post{$_}\n";
	}
	print STDERR "\nraw response:\n";
	foreach(@$raw) {
	foreach (@{$raw}) {
		print STDERR "---\n";
		foreach(@$_) {
		foreach (@{$_}) {
			print STDERR "$_\n";
		}
	}
@@ -293,8 +290,8 @@ if ($debug) {

$cons = parse_content($raw);

for ($i = 0; $con = $cons->[$i]; $i++) {
	for ($j = 0; $part = $con->[$j]; $j++) {
for (my $i = 0; my $con = $cons->[$i]; $i++) {
	for (my $j = 0; my $part = $con->[$j]; $j++) {
		foreach (@{$part->{extra}}) {
			unless ($ignore_info and $_ =~ /$ignore_info/i) {
				print "# $_\n";