aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/livestreamer/__init__.py
blob: f8a4fa2fd0d4eac21ee153e1b7f504f49a8b0a2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from . import plugins, stream
from .compat import urlparse

def resolve_url(url):
    parsed = urlparse(url)

    if len(parsed.scheme) == 0:
        url = "http://" + url

    for name, plugin in plugins.get_plugins().items():
        if plugin.can_handle_url(url):
            obj = plugin(url)
            return obj

    raise plugins.NoPluginError()

def get_plugins():
    return plugins.get_plugins()

PluginError = plugins.PluginError
NoStreamsError = plugins.NoStreamsError
NoPluginError = plugins.NoPluginError
StreamError = stream.StreamError

plugins.load_plugins(plugins)

__all__ = ["resolve_url", "get_plugins",
           "PluginError", "NoStreamsError", "NoPluginError",
           "StreamError"]