Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Travel-Status-DE-HAFAS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
derf
Travel-Status-DE-HAFAS
Commits
91a31f67
Commit
91a31f67
authored
13 years ago
by
Birte Kristina Friesel
Browse files
Options
Downloads
Patches
Plain Diff
DeutscheBahn/Result: Add delay accessor, remove info_raw
parent
d0f1eccd
No related branches found
Branches containing commit
Tags
4.13
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Changelog
+1
-1
1 addition, 1 deletion
Changelog
bin/db-ris
+1
-3
1 addition, 3 deletions
bin/db-ris
lib/Travel/Status/DE/DeutscheBahn/Result.pm
+20
-7
20 additions, 7 deletions
lib/Travel/Status/DE/DeutscheBahn/Result.pm
with
22 additions
and
11 deletions
Changelog
+
1
−
1
View file @
91a31f67
...
...
@@ -3,8 +3,8 @@ git HEAD
[Travel::Status::DE::DeutscheBahn::Result]
* The info accessor now strips the mostly useless "k.A." / "pünktlich"
(train on time) text parts
* Use the new info_raw accessor to get the old info results
* Add (slightly experimental) route_interesting accessor
* Add delay accessor
Travel::Status::DE::DeutscheBahn 0.03 - Wed Jul 13 2011
...
...
This diff is collapsed.
Click to expand it.
bin/db-ris
+
1
−
3
View file @
91a31f67
...
...
@@ -88,15 +88,13 @@ for my $d ( $status->results() ) {
my
@via
;
my
$re_late
=
qr{ (?: ^ | , ) ca[.] \s \d+ \s Minuten \s sp.ter}
ox
;
@via
=
$d
->
route
;
if
(
$filter_via
and
not
(
first
{
$_
=~
m{$filter_via}io
}
@via
)
)
{
next
;
}
if
(
$ignore_late
and
$d
->
info
=~
$re_late
)
{
if
(
$ignore_late
and
$d
->
delay
)
{
next
;
}
...
...
This diff is collapsed.
Click to expand it.
lib/Travel/Status/DE/DeutscheBahn/Result.pm
+
20
−
7
View file @
91a31f67
...
...
@@ -38,6 +38,21 @@ sub info {
return
$info
;
}
sub
delay
{
my
(
$self
)
=
@_
;
my
$info
=
$self
->
info_raw
;
if
(
$info
=~
m{ p.nktlich }ox
)
{
return
0
;
}
if
(
$info
=~
m{ ca[.] \s (?<delay> \d+ ) \s Minuten \s sp.ter }ox
)
{
return
$+
{
delay
};
}
return
;
}
sub
origin
{
my
(
$self
)
=
@_
;
...
...
@@ -156,16 +171,14 @@ either the train's destination or its origin station.
Convenience aliases for $result->route_end.
=item $result->
info
=item $result->
delay
Returns additional information, for instance in case the train is delayed. May
be an empty string if no (useful) information is available.
Returns the train's delay in steps of 5 minutes, or undef if it is unknown.
=item $result->info
_raw
=item $result->info
Returns the raw info string. B<info> only tells you about delays, platform
changes and such, B<info_raw> also explicitly states wether a train is on time
or no information is available.
Returns additional information, for instance the reason why the train is
delayed. May be an empty string if no (useful) information is available.
=item $result->platform
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment