summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen/Helper/HAFAS.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/DBInfoscreen/Helper/HAFAS.pm')
-rw-r--r--lib/DBInfoscreen/Helper/HAFAS.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/DBInfoscreen/Helper/HAFAS.pm b/lib/DBInfoscreen/Helper/HAFAS.pm
index 2eda72f..2eb156c 100644
--- a/lib/DBInfoscreen/Helper/HAFAS.pm
+++ b/lib/DBInfoscreen/Helper/HAFAS.pm
@@ -198,6 +198,18 @@ sub trainsearch {
}
}
+ if ($result) {
+
+ # The trip_id's date part doesn't seem to matter -- so far, HAFAS is
+ # happy as long as the date part starts with a number. HAFAS-internal
+ # tripIDs use this format (withouth leading zero for day of month < 10)
+ # though, so let's stick with it.
+ my $date_map = $opt{date_yyyy};
+ $date_map =~ tr{.}{}d;
+ $result->{trip_id} = sprintf( '1|%d|%d|%d|%s',
+ $result->{id}, $result->{cycle}, $result->{pool}, $date_map );
+ }
+
return $result;
}