diff options
author | Christopher Rosell <chrippa@tanuki.se> | 2012-03-21 13:10:02 +0100 |
---|---|---|
committer | Christopher Rosell <chrippa@tanuki.se> | 2012-03-21 13:10:02 +0100 |
commit | f175241692dfc461d773589653fd55c47508a293 (patch) | |
tree | 38e9bb2416c5631ea08038d607d46384d2c67758 /src/livestreamer/plugins/__init__.py | |
parent | 4ea8ddfd4d89ca96e81ddf07ec3c7d0abfc8de70 (diff) |
Change the way plugins are used.
Also use http as default protocol when URL is
missing protocol.
Diffstat (limited to 'src/livestreamer/plugins/__init__.py')
-rw-r--r-- | src/livestreamer/plugins/__init__.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/livestreamer/plugins/__init__.py b/src/livestreamer/plugins/__init__.py index 1f4c268..1eaf829 100644 --- a/src/livestreamer/plugins/__init__.py +++ b/src/livestreamer/plugins/__init__.py @@ -6,21 +6,26 @@ import imp plugins_loaded = {} class Plugin(object): - def can_handle_url(self, url): - raise NotImplementedError - - def get_streams(self, channel): - raise NotImplementedError + def __init__(self, url): + self.url = url - def stream_cmdline(self, stream, filename): - raise NotImplementedError + @classmethod + def can_handle_url(self, url): + raise NotImplementedError + @classmethod def handle_parser(self, parser): pass + @classmethod def handle_args(self, args): self.args = args + def get_streams(self): + raise NotImplementedError + + def stream_cmdline(self, stream, filename): + raise NotImplementedError def load_plugins(plugins): for loader, name, ispkg in pkgutil.iter_modules(plugins.__path__): @@ -33,5 +38,4 @@ def get_plugins(): return plugins_loaded def register_plugin(name, klass): - obj = klass() - plugins_loaded[name] = obj + plugins_loaded[name] = klass |