Merge branch 'threads'
Conflicts: weboob/frontends/videoob/application.py
This commit is contained in:
commit
926a25b992
14 changed files with 305 additions and 65 deletions
|
|
@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
"""
|
||||
|
||||
import sys
|
||||
from weboob.tools.application import PromptApplication
|
||||
from weboob.capabilities.dating import ICapDating
|
||||
|
||||
|
|
@ -59,7 +60,19 @@ class HaveSex(PromptApplication):
|
|||
print profile.get_profile_text()
|
||||
return True
|
||||
|
||||
@PromptApplication.command("start profiles walker")
|
||||
def command_walker(self):
|
||||
def service(self, action, function):
|
||||
sys.stdout.write('%s:' % action)
|
||||
for backend in self.weboob.iter_backends():
|
||||
backend.start_profiles_walker()
|
||||
sys.stdout.write(' ' + backend.name)
|
||||
sys.stdout.flush()
|
||||
getattr(backend, function)()
|
||||
sys.stdout.write('.\n')
|
||||
|
||||
@PromptApplication.command("start profiles walker")
|
||||
def command_walker(self, action):
|
||||
if action == 'start':
|
||||
self.service('Starting walker', 'start_profiles_walker')
|
||||
elif action == 'stop':
|
||||
self.service('Stopping walker', 'stop_profiles_walker')
|
||||
else:
|
||||
print >>sys.stderr, 'Syntax: walker (start|stop)'
|
||||
|
|
|
|||
|
|
@ -70,7 +70,11 @@ class Videoob(ConsoleApplication):
|
|||
else:
|
||||
results['BEFORE'] = u'Last videos'
|
||||
results['HEADER'] = ('ID', 'Title', 'Duration')
|
||||
for backend in self.weboob.iter_backends():
|
||||
results[backend.name] = [(video.id, video.title, video.formatted_duration) for video in
|
||||
backend.iter_search_results(pattern=pattern, nsfw=self.options.nsfw)]
|
||||
|
||||
for backend, video in self.weboob.do('iter_search_results', pattern=pattern, nsfw=self.options.nsfw):
|
||||
row = (video.id, video.title, video.formatted_duration)
|
||||
try:
|
||||
results[backend.name].append(row)
|
||||
except KeyError:
|
||||
results[backend.name] = [row]
|
||||
return results
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue