aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Christopher Rosell <chrippa@tanuki.se>2012-01-19 22:50:30 +0100
committerGravatar Christopher Rosell <chrippa@tanuki.se>2012-01-19 22:50:30 +0100
commit96c33449eefbf0c5257c56aa8109628351a18b59 (patch)
tree3aaad8418748740dba707aa54b12cb6303524f4e /src
parent7633731ba2d09e0595906dbdc144251988aa84f7 (diff)
Plugins can now add extra arguments to the cli.
Diffstat (limited to 'src')
-rw-r--r--src/livestreamer/cli.py6
-rw-r--r--src/livestreamer/plugins/__init__.py6
2 files changed, 12 insertions, 0 deletions
diff --git a/src/livestreamer/cli.py b/src/livestreamer/cli.py
index 7bb57e2..3239e81 100644
--- a/src/livestreamer/cli.py
+++ b/src/livestreamer/cli.py
@@ -59,6 +59,9 @@ def print_plugins():
def main():
+ for name, plugin in livestreamer.get_plugins().items():
+ plugin.handle_parser(parser)
+
arglist = sys.argv[1:]
if os.path.exists(livestreamer.RCFILE):
@@ -66,6 +69,9 @@ def main():
args = parser.parse_args(arglist)
+ for name, plugin in livestreamer.get_plugins().items():
+ plugin.handle_args(args)
+
if args.url:
handle_url(args)
elif args.plugins:
diff --git a/src/livestreamer/plugins/__init__.py b/src/livestreamer/plugins/__init__.py
index 3999574..1f4c268 100644
--- a/src/livestreamer/plugins/__init__.py
+++ b/src/livestreamer/plugins/__init__.py
@@ -15,6 +15,12 @@ class Plugin(object):
def stream_cmdline(self, stream, filename):
raise NotImplementedError
+ def handle_parser(self, parser):
+ pass
+
+ def handle_args(self, args):
+ self.args = args
+
def load_plugins(plugins):
for loader, name, ispkg in pkgutil.iter_modules(plugins.__path__):