support roadmaps in ICapTravel (closes #680)
This commit is contained in:
parent
729b5e9c8f
commit
6fa7a49349
1 changed files with 22 additions and 2 deletions
|
|
@ -18,7 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from datetime import time, datetime
|
||||
from datetime import time, datetime, timedelta
|
||||
|
||||
from .base import IBaseCap, CapBaseObject
|
||||
|
||||
|
|
@ -34,7 +34,6 @@ class Station(CapBaseObject):
|
|||
def __repr__(self):
|
||||
return "<Station id=%r name=%r>" % (self.id, self.name)
|
||||
|
||||
|
||||
class Departure(CapBaseObject):
|
||||
def __init__(self, id, _type, _time):
|
||||
CapBaseObject.__init__(self, id)
|
||||
|
|
@ -51,6 +50,17 @@ class Departure(CapBaseObject):
|
|||
return u"<Departure id=%r type=%r time=%r departure=%r arrival=%r>" % (
|
||||
self.id, self.type, self.time.strftime('%H:%M'), self.departure_station, self.arrival_station)
|
||||
|
||||
class RoadStep(CapBaseObject):
|
||||
def __init__(self, id):
|
||||
CapBaseObject.__init__(self, id)
|
||||
|
||||
self.add_field('line', basestring)
|
||||
self.add_field('start_time', time)
|
||||
self.add_field('end_time', time)
|
||||
self.add_field('departure', unicode)
|
||||
self.add_field('arrival', unicode)
|
||||
self.add_field('duration', timedelta)
|
||||
|
||||
class ICapTravel(IBaseCap):
|
||||
def iter_station_search(self, pattern):
|
||||
"""
|
||||
|
|
@ -70,3 +80,13 @@ class ICapTravel(IBaseCap):
|
|||
@return [iter] result of Departure objects
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def iter_roadmap(self, departure, arrival):
|
||||
"""
|
||||
Get a roadmap.
|
||||
|
||||
@param departure [str] name of departure station
|
||||
@param arrival [str] name of arrival station
|
||||
@return [iter(RoadStep)] steps of roadmap
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue