Commit 7c502ca2 authored by Romain Bignon's avatar Romain Bignon

use Weboob.do insteal of deprecated iter_backends in some frontends

parent ad240e7a
......@@ -106,9 +106,8 @@ class Monboob(ConsoleApplication):
self.weboob.loop()
def process(self):
for backend in self.weboob.iter_backends():
for message in backend.iter_new_messages():
self.send_email(backend, message)
for backend, message in self.weboob.do('iter_new_messages'):
self.send_email(backend, message)
def send_email(self, backend, mail):
domain = self.config.get('domain')
......
......@@ -66,22 +66,17 @@ class Videoob(ConsoleApplication):
else:
results['BEFORE'] = u'Last videos'
results['HEADER'] = ('ID', 'Title', 'Duration')
for backend in self.weboob.iter_backends():
for backend, video in self.weboob.do('iter_search_results', pattern):
row = (video.id, video.title, '%d:%02d:%02d' % (video.duration/3600, (video.duration%3600/60), video.duration%60))
try:
iterator = backend.iter_search_results(pattern)
except NotImplementedError:
continue
else:
rows = []
for video in iterator:
rows.append((video.id, video.title, '%d:%02d:%02d' % (video.duration/3600, (video.duration%3600/60), video.duration%60)))
results[backend.name] = rows
results[backend.name].append(row)
except KeyError:
results[backend.name] = [row]
return results
@ConsoleApplication.command('Get video file URL from page URL')
def command_file_url(self, url):
for backend in self.weboob.iter_backends():
video = backend.get_video(url)
for backend, video in self.weboob.do('get_video', url):
if video:
print video.url
break
......@@ -162,3 +162,4 @@ class BaseApplication(object):
print 'Program killed by SIGINT'
except ConfigError, e:
print 'Configuration error: %s' % e
sys.exit(1)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment