Exemplo n.º 1
0
    def test_build_stream_url_rtsp(self):
        a = AuthSign(service=Service.STREAMTVNOW, auth=("fake", "fake"))
        a.expiration_date = datetime.now() + timedelta(minutes=240)
        a.hash = "abc1234"

        generated = self.g.build_stream_url(Server.EU_MIX, 3, a, Quality.LQ,
                                            Protocol.RTSP)

        self.assertEqual(
            "rtsp://deu.smoothstreams.tv:2935/viewstvn/ch03q3.stream/playlist.m3u8?wmsAuthSign=abc1234",
            generated,
        )
Exemplo n.º 2
0
    def test_build_stream_url_live247_dash(self):
        a = AuthSign(service=Service.LIVE247, auth=("fake", "fake"))
        # set hash and expiration manually
        a.expiration_date = datetime.now() + timedelta(minutes=240)
        a.hash = "abc1234"

        generated = self.g.build_stream_url(Server.NA_EAST_NY, 44, a,
                                            Quality.HD, Protocol.DASH)

        self.assertEqual(
            "https://dnae2.smoothstreams.tv:443/view247/ch44.smil/manifest.mpd?wmsAuthSign=abc1234",
            generated,
        )
Exemplo n.º 3
0
    def test_build_stream_url_streamtvnow_mpeg(self):
        a = AuthSign(service=Service.STREAMTVNOW, auth=("fake", "fake"))
        # set hash and expiration manually
        a.expiration_date = datetime.now() + timedelta(minutes=240)
        a.hash = "abc1234"

        generated = self.g.build_stream_url(Server.EU_MIX, 3, a, Quality.LQ,
                                            Protocol.MPEG)

        self.assertEqual(
            "https://deu.smoothstreams.tv:443/viewstvn/ch03q3.stream/mpeg.2ts?wmsAuthSign=abc1234",
            generated,
        )
Exemplo n.º 4
0
    def test_build_stream_url_streamtvnow_hls(self):
        a = AuthSign(service=Service.STREAMTVNOW, auth=("fake", "fake"))
        # set hash and expiration manually
        a.expiration_date = datetime.now() + timedelta(minutes=240)
        a.hash = "abc1234"

        generated = self.g.build_stream_url(Server.ASIA_MIX, 10, a, Quality.LQ,
                                            Protocol.HLS)

        self.assertEqual(
            "https://dAP.smoothstreams.tv:443/viewstvn/ch10q3.stream/playlist.m3u8?wmsAuthSign=abc1234",
            generated,
        )
Exemplo n.º 5
0
    def test_build_stream_url_live247_rtmp(self):
        a = AuthSign(service=Service.LIVE247, auth=("fake", "fake"))
        # set hash and expiration manually
        a.expiration_date = datetime.now() + timedelta(minutes=240)
        a.hash = "abc1234"

        generated = self.g.build_stream_url(Server.NA_EAST_NY, 44, a,
                                            Quality.HD, Protocol.RTMP)

        self.assertEqual(
            "rtmp://dnae2.smoothstreams.tv:3625/view247/ch44q1.stream/playlist.m3u8?wmsAuthSign=abc1234",
            generated,
        )
Exemplo n.º 6
0
    def test_generate_m3u_playlist(self, mock_urlopen):

        a = AuthSign(service=Service.LIVE247, auth=("fake", "fake"))
        a.expiration_date = datetime.now() + timedelta(minutes=240)
        a.hash = "abc1234"

        p = Playlist(a, self.g)

        with open("./tests/test_sample.m3u") as f:
            self.assertEqual(
                f.read(),
                p.generate_m3u_playlist(Server.NA_EAST_NY, a, Quality.HD,
                                        Protocol.HLS),
            )