2014-01-27 05:47:30 +01:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2013-09-23 17:59:27 +02:00
|
|
|
from .common import FileDownloader
|
|
|
|
from .hls import HlsFD
|
2014-09-24 14:16:56 +02:00
|
|
|
from .hls import NativeHlsFD
|
2013-09-23 17:59:27 +02:00
|
|
|
from .http import HttpFD
|
|
|
|
from .mplayer import MplayerFD
|
|
|
|
from .rtmp import RtmpFD
|
2013-12-23 16:39:49 +01:00
|
|
|
from .f4m import F4mFD
|
2013-09-23 17:59:27 +02:00
|
|
|
|
|
|
|
from ..utils import (
|
2015-01-23 23:50:31 +01:00
|
|
|
determine_protocol,
|
2013-09-23 17:59:27 +02:00
|
|
|
)
|
|
|
|
|
2015-01-23 23:50:31 +01:00
|
|
|
PROTOCOL_MAP = {
|
|
|
|
'rtmp': RtmpFD,
|
|
|
|
'm3u8_native': NativeHlsFD,
|
|
|
|
'm3u8': HlsFD,
|
|
|
|
'mms': MplayerFD,
|
|
|
|
'rtsp': MplayerFD,
|
|
|
|
'f4m': F4mFD,
|
|
|
|
}
|
2014-01-25 12:02:43 +01:00
|
|
|
|
2015-01-23 23:50:31 +01:00
|
|
|
|
|
|
|
def get_suitable_downloader(info_dict, params={}):
|
2013-09-23 17:59:27 +02:00
|
|
|
"""Get the downloader class that can handle the info dict."""
|
2015-01-23 23:50:31 +01:00
|
|
|
protocol = determine_protocol(info_dict)
|
|
|
|
info_dict['protocol'] = protocol
|
|
|
|
|
|
|
|
return PROTOCOL_MAP.get(protocol, HttpFD)
|
|
|
|
|
2014-11-23 22:25:12 +01:00
|
|
|
|
|
|
|
__all__ = [
|
|
|
|
'get_suitable_downloader',
|
|
|
|
'FileDownloader',
|
|
|
|
]
|