aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/livestreamer/__init__.py
blob: 1369fe56e6ec453f09512610bec0f17e7ff6e483 (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
from livestreamer import plugins
from livestreamer import stream
from livestreamer.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)