Merge branch 'master' of ssh+git://git.symlink.me/var/git/pub/juke/weboob
This commit is contained in:
commit
9c828733ab
5 changed files with 27 additions and 15 deletions
|
|
@ -46,4 +46,5 @@ class TransilienBackend(Backend, ICapTravel):
|
||||||
departure.arrival_station = d['arrival']
|
departure.arrival_station = d['arrival']
|
||||||
departure.late = d['late']
|
departure.late = d['late']
|
||||||
departure.information = d['late_reason']
|
departure.information = d['late_reason']
|
||||||
|
departure.plateform = d['plateform']
|
||||||
yield departure
|
yield departure
|
||||||
|
|
|
||||||
|
|
@ -133,12 +133,20 @@ class Transilien(Browser):
|
||||||
else:
|
else:
|
||||||
self.location('http://www.transilien.com/web/ITProchainsTrains.do?tr3a=%s&urlModule=/site/pid/184' % station_id)
|
self.location('http://www.transilien.com/web/ITProchainsTrains.do?tr3a=%s&urlModule=/site/pid/184' % station_id)
|
||||||
for route in self.page.document.list_route:
|
for route in self.page.document.list_route:
|
||||||
yield {'type': toUnicode(route.code_mission),
|
_late_reason = None
|
||||||
'time': datetime.combine(date.today(), time(*[int(x) for x in route.time.split(':')])),
|
try :
|
||||||
'departure': toUnicode(station_id),
|
_time = datetime.combine(date.today(), time(*[int(x) for x in route.time.split(':')]))
|
||||||
'arrival': toUnicode(route.destination),
|
except ValueError:
|
||||||
'late': time(),
|
_time = None
|
||||||
'late_reason': toUnicode(route.platform)}
|
_late_reason = route.time
|
||||||
|
else:
|
||||||
|
yield {'type': toUnicode(route.code_mission),
|
||||||
|
'time': _time,
|
||||||
|
'departure': toUnicode(station_id),
|
||||||
|
'arrival': toUnicode(route.destination),
|
||||||
|
'late': time(),
|
||||||
|
'late_reason': _late_reason,
|
||||||
|
'plateform': toUnicode(route.platform)}
|
||||||
|
|
||||||
def home(self):
|
def home(self):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Copyright(C) 2010 Romain Bignon
|
Copyright(C) 2010 Romain Bignon, Julien Hebert
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -59,6 +59,7 @@ class Departure(object):
|
||||||
self.arrival_station = u''
|
self.arrival_station = u''
|
||||||
self.late = time()
|
self.late = time()
|
||||||
self.information = u''
|
self.information = u''
|
||||||
|
self.plateform = u''
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<Departure id='%s' type='%s' time='%s' departure='%s' arrival='%s'>" % (self.id,
|
return "<Departure id='%s' type='%s' time='%s' departure='%s' arrival='%s'>" % (self.id,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Copyright(C) 2010 Romain Bignon
|
Copyright(C) 2010 Romain Bignon, Julien Hébert
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -45,18 +45,19 @@ class Travel(ConsoleApplication):
|
||||||
|
|
||||||
@ConsoleApplication.command('List all departures on a special station')
|
@ConsoleApplication.command('List all departures on a special station')
|
||||||
def command_departures(self, station, arrival=None):
|
def command_departures(self, station, arrival=None):
|
||||||
print ".-----.-----------.-------.-----------------------.-------.--------------------."
|
print ".-----.-----------.-------.-----------------------.-------.--------------------.------------"
|
||||||
print "| ID | Type | Time | Arrival | Late | Info |"
|
print "| ID | Type | Time | Arrival | Late | Info | Plateform |"
|
||||||
print "+-----+-----------+-------+-----------------------+-------+--------------------+"
|
print "+-----+-----------+-------+-----------------------+-------+--------------------+-----------+"
|
||||||
count = 0
|
count = 0
|
||||||
for name, backend, in self.weboob.iter_backends():
|
for name, backend, in self.weboob.iter_backends():
|
||||||
for departure in backend.iter_station_departures(station, arrival):
|
for departure in backend.iter_station_departures(station, arrival):
|
||||||
print u"|%4d | %-10s|%6s | %-22s|%6s | %-19s|" % (departure.id,
|
print u"|%4d | %-10s|%6s | %-22s|%6s | %-19s| %-10s|" % (departure.id,
|
||||||
departure.type,
|
departure.type,
|
||||||
departure.time.strftime("%H:%M"),
|
departure.time.strftime("%H:%M"),
|
||||||
departure.arrival_station,
|
departure.arrival_station,
|
||||||
departure.late and departure.late.strftime("%H:%M") or '',
|
departure.late and departure.late.strftime("%H:%M") or '',
|
||||||
departure.information)
|
departure.information,
|
||||||
|
departure.plateform)
|
||||||
count += 1
|
count += 1
|
||||||
print "+-----'-----------'-------'-----------------------'-------'--------------------+"
|
print "+-----'-----------'-------'-----------------------'-------'--------------------+"
|
||||||
print "| %3d departures listed |" % count
|
print "| %3d departures listed |" % count
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Copyright(C) 2010 Romain Bignon
|
Copyright(C) 2010 Romain Bignon, Julien Hébert
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -85,7 +85,8 @@ class ConsoleApplication(BaseApplication):
|
||||||
nb_args = len(_args) - 1
|
nb_args = len(_args) - 1
|
||||||
if defaults:
|
if defaults:
|
||||||
nb_args -= len(defaults)
|
nb_args -= len(defaults)
|
||||||
if len(args) < nb_args or len(args) > nb_args and not varargs:
|
|
||||||
|
if len(args) < nb_args and not varargs:
|
||||||
if varargs:
|
if varargs:
|
||||||
sys.stderr.write("Command '%s' takes at least %d arguments.\n" % (command, nb_args))
|
sys.stderr.write("Command '%s' takes at least %d arguments.\n" % (command, nb_args))
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue