Weboob.iter_backends() does not return backend name anymore
This commit is contained in:
parent
3ea53cd2f0
commit
daa27da3ce
10 changed files with 20 additions and 20 deletions
|
|
@ -96,7 +96,7 @@ class Monboob(ConsoleApplication):
|
||||||
self.weboob.loop()
|
self.weboob.loop()
|
||||||
|
|
||||||
def process(self):
|
def process(self):
|
||||||
for name, backend in self.weboob.iter_backends():
|
for backend in self.weboob.iter_backends():
|
||||||
for message in backend.iter_new_messages():
|
for message in backend.iter_new_messages():
|
||||||
self.send_email(backend, message)
|
self.send_email(backend, message)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,13 +39,13 @@ class Boobank(ConsoleApplication):
|
||||||
@ConsoleApplication.command('List every available accounts')
|
@ConsoleApplication.command('List every available accounts')
|
||||||
def command_list(self):
|
def command_list(self):
|
||||||
accounts = []
|
accounts = []
|
||||||
for name, backend, in self.weboob.iter_backends():
|
for backend, in self.weboob.iter_backends():
|
||||||
try:
|
try:
|
||||||
for account in backend.iter_accounts():
|
for account in backend.iter_accounts():
|
||||||
accounts.append('%17s %-20s %11.2f %11.2f' % (
|
accounts.append('%17s %-20s %11.2f %11.2f' % (
|
||||||
account.id, account.label, account.balance, account.coming))
|
account.id, account.label, account.balance, account.coming))
|
||||||
except weboob.tools.browser.BrowserIncorrectPassword:
|
except weboob.tools.browser.BrowserIncorrectPassword:
|
||||||
print >>sys.stderr, 'Error: Incorrect password for backend %s' % name
|
print >>sys.stderr, 'Error: Incorrect password for backend %s' % backend.name
|
||||||
return 1
|
return 1
|
||||||
if len(accounts):
|
if len(accounts):
|
||||||
print ' ID Account Balance Coming '
|
print ' ID Account Balance Coming '
|
||||||
|
|
@ -58,7 +58,7 @@ class Boobank(ConsoleApplication):
|
||||||
def command_coming(self, id):
|
def command_coming(self, id):
|
||||||
operations = []
|
operations = []
|
||||||
found = 0
|
found = 0
|
||||||
for name, backend in self.weboob.iter_backends():
|
for backend in self.weboob.iter_backends():
|
||||||
try:
|
try:
|
||||||
account = backend.get_account(id)
|
account = backend.get_account(id)
|
||||||
except AccountNotFound:
|
except AccountNotFound:
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ class Dummy(BaseApplication):
|
||||||
def main(self, argv):
|
def main(self, argv):
|
||||||
self.weboob.load_backends()
|
self.weboob.load_backends()
|
||||||
|
|
||||||
for name, backend in self.weboob.iter_backends():
|
for backend in self.weboob.iter_backends():
|
||||||
print 'Backend [%s]' % name
|
print 'Backend [%s]' % backend.name
|
||||||
if backend.has_caps(ICapMessages):
|
if backend.has_caps(ICapMessages):
|
||||||
print '|- ICapMessages [Print its messages]'
|
print '|- ICapMessages [Print its messages]'
|
||||||
for message in backend.iter_messages():
|
for message in backend.iter_messages():
|
||||||
|
|
|
||||||
|
|
@ -59,5 +59,5 @@ class HaveSex(PromptApplication):
|
||||||
|
|
||||||
@PromptApplication.command("start profiles walker")
|
@PromptApplication.command("start profiles walker")
|
||||||
def command_walker(self):
|
def command_walker(self):
|
||||||
for name, backend in self.weboob.iter_backends():
|
for backend in self.weboob.iter_backends():
|
||||||
backend.start_profiles_walker()
|
backend.start_profiles_walker()
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class Travel(ConsoleApplication):
|
||||||
print '| ID | Name |'
|
print '| ID | Name |'
|
||||||
print '+--------------------------------+---------------------------------------------+'
|
print '+--------------------------------+---------------------------------------------+'
|
||||||
count = 0
|
count = 0
|
||||||
for name, backend, in self.weboob.iter_backends():
|
for backend, in self.weboob.iter_backends():
|
||||||
for station in backend.iter_station_search(pattern):
|
for station in backend.iter_station_search(pattern):
|
||||||
print '| %-31s| %-44s|' % (station.id, station.name)
|
print '| %-31s| %-44s|' % (station.id, station.name)
|
||||||
count += 1
|
count += 1
|
||||||
|
|
@ -49,7 +49,7 @@ class Travel(ConsoleApplication):
|
||||||
print "| ID | Type | Time | Arrival | Late | Info | Plateform |"
|
print "| ID | Type | Time | Arrival | Late | Info | Plateform |"
|
||||||
print "+-----+-----------+-------+-----------------------+-------+--------------------+-----------+"
|
print "+-----+-----------+-------+-----------------------+-------+--------------------+-----------+"
|
||||||
count = 0
|
count = 0
|
||||||
for name, backend, in self.weboob.iter_backends():
|
for 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| %-10s|" % (departure.id,
|
print u"|%4d | %-10s|%6s | %-22s|%6s | %-19s| %-10s|" % (departure.id,
|
||||||
departure.type,
|
departure.type,
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ class TransilienUI():
|
||||||
liste = []
|
liste = []
|
||||||
|
|
||||||
#liste = ConfFile('/opt/masstransit/masstransit.cfg').config.items('ListeDesGares')
|
#liste = ConfFile('/opt/masstransit/masstransit.cfg').config.items('ListeDesGares')
|
||||||
for name, backend in self.weboob.iter_backends():
|
for backend in self.weboob.iter_backends():
|
||||||
for station in backend.iter_station_search(""):
|
for station in backend.iter_station_search(""):
|
||||||
liste.append(station)
|
liste.append(station)
|
||||||
|
|
||||||
|
|
@ -141,7 +141,7 @@ class TransilienUI():
|
||||||
def refresh(self):
|
def refresh(self):
|
||||||
"update departures"
|
"update departures"
|
||||||
self.treestore.clear()
|
self.treestore.clear()
|
||||||
for name, backend in self.weboob.iter_backends():
|
for backend in self.weboob.iter_backends():
|
||||||
for station in backend.iter_station_search(self.combo_source.get_current_text()):
|
for station in backend.iter_station_search(self.combo_source.get_current_text()):
|
||||||
for arrival in backend.iter_station_search(self.combo_dest.get_current_text()):
|
for arrival in backend.iter_station_search(self.combo_dest.get_current_text()):
|
||||||
for departure in backend.iter_station_departures(station.id, arrival.id):
|
for departure in backend.iter_station_departures(station.id, arrival.id):
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class Videoob(ConsoleApplication):
|
||||||
|
|
||||||
@ConsoleApplication.command('Get video file URL from page URL')
|
@ConsoleApplication.command('Get video file URL from page URL')
|
||||||
def command_file_url(self, url):
|
def command_file_url(self, url):
|
||||||
for name, backend in self.weboob.iter_backends(ICapVideoProvider):
|
for backend in self.weboob.iter_backends(ICapVideoProvider):
|
||||||
video_url = backend.get_video_url(url)
|
video_url = backend.get_video_url(url)
|
||||||
if video_url:
|
if video_url:
|
||||||
print video_url
|
print video_url
|
||||||
|
|
@ -39,7 +39,7 @@ class Videoob(ConsoleApplication):
|
||||||
|
|
||||||
@ConsoleApplication.command('Get video title from page URL')
|
@ConsoleApplication.command('Get video title from page URL')
|
||||||
def command_title(self, url):
|
def command_title(self, url):
|
||||||
for name, backend in self.weboob.iter_backends(ICapVideoProvider):
|
for backend in self.weboob.iter_backends(ICapVideoProvider):
|
||||||
video_title = backend.get_video_title(url)
|
video_title = backend.get_video_title(url)
|
||||||
if video_title:
|
if video_title:
|
||||||
print video_title
|
print video_title
|
||||||
|
|
|
||||||
|
|
@ -106,8 +106,8 @@ class WeboobCfg(ConsoleApplication):
|
||||||
|
|
||||||
@ConsoleApplication.command('Remove a backend')
|
@ConsoleApplication.command('Remove a backend')
|
||||||
def command_remove(self, name):
|
def command_remove(self, name):
|
||||||
if not name in self.weboob.backends_config.iter_backends():
|
try:
|
||||||
|
self.weboob.backends_config.remove_backend(name)
|
||||||
|
except ConfigParser.NoSectionError:
|
||||||
print >>sys.stderr, "Backend '%s' does not exist" % name
|
print >>sys.stderr, "Backend '%s' does not exist" % name
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
self.weboob.backends_config.remove_backend(name)
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class WetBoobs(ConsoleApplication):
|
||||||
print '| ID | Name |'
|
print '| ID | Name |'
|
||||||
print '+--------------------------------+---------------------------------------------+'
|
print '+--------------------------------+---------------------------------------------+'
|
||||||
count = 0
|
count = 0
|
||||||
for name, backend, in self.weboob.iter_backends():
|
for backend, in self.weboob.iter_backends():
|
||||||
for city in backend.iter_city_search(pattern):
|
for city in backend.iter_city_search(pattern):
|
||||||
print u'| %-31s| %-44s|' % (city.city_id, city.name)
|
print u'| %-31s| %-44s|' % (city.city_id, city.name)
|
||||||
count += 1
|
count += 1
|
||||||
|
|
@ -49,7 +49,7 @@ class WetBoobs(ConsoleApplication):
|
||||||
print '| Temperature | Text |'
|
print '| Temperature | Text |'
|
||||||
print '+-------------+----------------------------------------------------------------+'
|
print '+-------------+----------------------------------------------------------------+'
|
||||||
found = 0
|
found = 0
|
||||||
for name, backend, in self.weboob.iter_backends():
|
for backend, in self.weboob.iter_backends():
|
||||||
try:
|
try:
|
||||||
current = backend.get_current(city)
|
current = backend.get_current(city)
|
||||||
print u'| %-12s| %-63s|' % (u'%d °%s' % (current.temp, current.unit), current.text)
|
print u'| %-12s| %-63s|' % (u'%d °%s' % (current.temp, current.unit), current.text)
|
||||||
|
|
@ -67,7 +67,7 @@ class WetBoobs(ConsoleApplication):
|
||||||
print '| Date | Min | Max | Text |'
|
print '| Date | Min | Max | Text |'
|
||||||
print '+-------------+-------+-------+------------------------------------------------+'
|
print '+-------------+-------+-------+------------------------------------------------+'
|
||||||
found = 0
|
found = 0
|
||||||
for name, backend, in self.weboob.iter_backends():
|
for backend, in self.weboob.iter_backends():
|
||||||
try:
|
try:
|
||||||
for f in backend.iter_forecast(city):
|
for f in backend.iter_forecast(city):
|
||||||
found = 1
|
found = 1
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ class Weboob:
|
||||||
def iter_backends(self, caps=None):
|
def iter_backends(self, caps=None):
|
||||||
for name, backend in self.backends.iteritems():
|
for name, backend in self.backends.iteritems():
|
||||||
if caps is None or backend.has_caps(caps):
|
if caps is None or backend.has_caps(caps):
|
||||||
yield (name, backend)
|
yield backend
|
||||||
|
|
||||||
def schedule(self, interval, function, *args):
|
def schedule(self, interval, function, *args):
|
||||||
return self.scheduler.schedule(interval, function, *args)
|
return self.scheduler.schedule(interval, function, *args)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue