factorisation: add a 'services' system
This commit is contained in:
parent
680e149a41
commit
b848347b7c
1 changed files with 16 additions and 3 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.tools.application import PromptApplication
|
||||||
from weboob.capabilities.dating import ICapDating
|
from weboob.capabilities.dating import ICapDating
|
||||||
|
|
||||||
|
|
@ -59,7 +60,19 @@ class HaveSex(PromptApplication):
|
||||||
print profile.get_profile_text()
|
print profile.get_profile_text()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@PromptApplication.command("start profiles walker")
|
def service(self, action, function):
|
||||||
def command_walker(self):
|
sys.stdout.write('%s:' % action)
|
||||||
for backend in self.weboob.iter_backends():
|
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)'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue