コード例 #1
0
ファイル: test_resolve.py プロジェクト: unlocKing/plugins
            def test(self, mock_http):
                self.session = Streamlink()
                self.session.load_plugins('plugins')

                mock_http.get = api.HTTPSession().get
                mock_http.json = api.HTTPSession().json

                Resolve.bind(self.session, "test.resolve")

                default_iframe = "http://mocked/default/iframe"
                file_url = _stream_data["url"]
                self_url = "http://mocked/live"

                with requests_mock.Mocker() as mock:
                    mock.get(default_iframe,
                             text=text_with_playlist % file_url)
                    mock.get(file_url, text=_stream_data["text"])
                    mock.get(self_url, text=_website_text)

                    self.session.set_plugin_option("resolve",
                                                   "whitelist_netloc",
                                                   ["mocked"])

                    plugin = Resolve(self_url)
                    streams = plugin._get_streams()
                    self.assertIn(_stream_data["name"], streams)
コード例 #2
0
ファイル: session.py プロジェクト: redstorm82/streamlink
    def __init__(self, options=None):
        self.http = api.HTTPSession()
        self.options = Options({
            "interface": None,
            "ipv4": False,
            "ipv6": False,
            "hds-live-edge": 10.0,
            "hds-segment-attempts": 3,
            "hds-segment-threads": 1,
            "hds-segment-timeout": 10.0,
            "hds-timeout": 60.0,
            "hls-live-edge": 3,
            "hls-segment-attempts": 3,
            "hls-segment-ignore-names": [],
            "hls-segment-threads": 1,
            "hls-segment-timeout": 10.0,
            "hls-segment-stream-data": False,
            "hls-timeout": 60.0,
            "hls-playlist-reload-attempts": 3,
            "hls-playlist-reload-time": "default",
            "hls-start-offset": 0,
            "hls-duration": None,
            "http-stream-timeout": 60.0,
            "hls-token-period": 60.0,
            "ringbuffer-size": 1024 * 1024 * 16,  # 16 MB
            "rtmp-timeout": 60.0,
            "rtmp-rtmpdump": is_win32 and "rtmpdump.exe" or "rtmpdump",
            "rtmp-proxy": None,
            "stream-segment-attempts": 3,
            "stream-segment-threads": 1,
            "stream-segment-timeout": 10.0,
            "stream-timeout": 60.0,
            "subprocess-errorlog": False,
            "subprocess-errorlog-path": None,
            "ffmpeg-ffmpeg": None,
            "ffmpeg-fout": None,
            "ffmpeg-video-transcode": None,
            "ffmpeg-audio-transcode": None,
            "ffmpeg-copyts": False,
            "ffmpeg-start-at-zero": False,
            "mux-subtitles": False,
            "locale": None,
            "user-input-requester": None
        })
        # felix add update headers cookies
        self.cache = Cache(filename="StreamlinkSession.json")

        if options:
            self.options.update(options)
        self.plugins = OrderedDict({})
        self.load_builtin_plugins()
コード例 #3
0
ファイル: session.py プロジェクト: AlexELEC/TVLINK-AE-PC
 def __init__(self, options=None):
     self.http = api.HTTPSession()
     self.options = Options({
         "hds-live-edge": 10.0,
         "hds-segment-attempts": 3,
         "hds-segment-threads": 1,
         "hds-segment-timeout": 10.0,
         "hds-timeout": 60.0,
         "hls-live-edge": 3,
         "hls-segment-attempts": 3,
         "hls-segment-ignore-names": [],
         "hls-segment-threads": 1,
         "hls-segment-timeout": 10.0,
         "hls-segment-stream-data": False,
         "hls-timeout": 60.0,
         "hls-playlist-reload-attempts": 3,
         "hls-playlist-reload-time":
         "default",  # default, duration, segment, average
         "hls-start-offset": 0,
         "hls-duration": None,
         "http-stream-timeout": 60.0,
         "ringbuffer-size": 1024 * 1024 * 16,  # 16 MB
         "rtmp-timeout": 60.0,
         "rtmp-rtmpdump": is_win32 and "rtmpdump.exe" or "rtmpdump",
         "rtmp-proxy": None,
         "stream-segment-attempts": 3,
         "stream-segment-threads": 1,
         "stream-segment-timeout": 10.0,
         "stream-timeout": 60.0,
         "subprocess-errorlog": False,
         "subprocess-errorlog-path": None,
         "ffmpeg-ffmpeg": None,
         "ffmpeg-fout": None,
         "ffmpeg-video-transcode": None,
         "ffmpeg-audio-transcode": None,
         "ffmpeg-copyts": False,
         "ffmpeg-start-at-zero": False,
         "mux-subtitles": False,
         "locale": None,
         "user-input-requester": None,
         "chunk-size-ts": 8192,
         "chunk-size-hls": 8192
     })
     if options:
         self.options.update(options)
     self.plugins = OrderedDict({})
     self.load_builtin_plugins()