-b is handled by BaseApplication

This commit is contained in:
Romain Bignon 2010-09-24 21:56:49 -04:00
commit aee0e49cc8
5 changed files with 40 additions and 35 deletions

View file

@ -57,7 +57,7 @@ class DefaultOptions():
class MyPlayer():
"""Black magic invoking a video player to this world.
Presently, due to strong disturbances in the holidays of the ether
world, the video player used is chosen from a static list of
programs. See PLAYERS for more information.
@ -82,11 +82,11 @@ class MyPlayer():
if self.options.verbose:
print "Video player is (%s,%s)" % (self.player,
self.player_stdin)
def play(self, video):
"""Play a video object, using programs from the PLAYERS list.
This function dispatch calls to either _play_default or
_play_rtmp for special rtmp streams using SWF verification.
"""
@ -289,7 +289,7 @@ class MyCmd(Cmd):
def do_search(self, pattern):
"""search [PATTERN]
Search for videos.
If no patterns are given, display the last entries.
"""
@ -307,7 +307,7 @@ class MyCmd(Cmd):
for i, (backend, video) in enumerate(videos_g):
self.videos.append((backend,video))
# code factorisatorminator: display the list of videos
self.do_ls("")
@ -334,8 +334,8 @@ class MyCmd(Cmd):
print_keys_values([
("url", video.url),
("duration", "%s seconds" % video.duration),
("rating", "%.2f/%.2f" % (video.rating,
video.rating_max))],
("rating", "%.2f/%.2f" % (video.rating or 0,
video.rating_max or 0))],
indent=4)

View file

@ -34,6 +34,9 @@ class WeboobCfg(ReplApplication):
VERSION = '0.1'
COPYRIGHT = 'Copyright(C) 2010 Christophe Benz, Romain Bignon'
def load_default_backends(self):
pass
def caps_included(self, modcaps, caps):
modcaps = [x.__name__ for x in modcaps]
for cap in caps:
@ -56,7 +59,7 @@ class WeboobCfg(ReplApplication):
self.weboob.modules_loader.load_all()
if name not in [_name for _name, backend in self.weboob.modules_loader.loaded.iteritems()]:
logging.error(u'Backend "%s" does not exist.' % name)
return 1
return
params = {}
# set backend params from command-line arguments
@ -65,7 +68,7 @@ class WeboobCfg(ReplApplication):
key, value = option.split('=', 1)
except ValueError:
logging.error(u'Parameters have to be formatted "key=value"')
return 1
return
params[key] = value
# ask for params non-specified on command-line arguments
backend = self.weboob.modules_loader.get_or_load_module(name)
@ -108,7 +111,7 @@ class WeboobCfg(ReplApplication):
except ConfigParser.DuplicateSectionError:
print 'Instance "%s" already exists for backend "%s".' % (new_name, name)
def do_listconfigured(self):
def do_list(self, line):
"""
list
@ -118,10 +121,11 @@ class WeboobCfg(ReplApplication):
for instance_name, name, params in sorted(self.weboob.backends_config.iter_backends()):
backend = self.weboob.modules_loader.get_or_load_module(name)
row = OrderedDict([('Instance name', instance_name),
('Backend name', name),
('Backend', name),
('Configuration', ', '.join('%s=%s' % (key, ('*****' if key in backend.config and backend.config[key].is_masked else value)) for key, value in params.iteritems())),
])
self.format(row)
self.flush()
def do_remove(self, instance_name):
"""