예제 #1
0
 def test_can_handle_url(self):
     # should match
     self.assertTrue(MPEGDASH.can_handle_url("http://example.com/foo.mpd"))
     self.assertTrue(
         MPEGDASH.can_handle_url("dash://http://www.testing.cat/directe"))
     self.assertTrue(
         MPEGDASH.can_handle_url("dash://https://www.testing.cat/directe"))
예제 #2
0
 def test_get_streams(self, parse_manifest):
     session = Mock()
     Plugin.bind(session, "tests.plugins.test_dash")
     p = MPEGDASH("http://example.com/foo.mpd")
     p.streams()
     parse_manifest.assert_called_with(session,
                                       "http://example.com/foo.mpd")
예제 #3
0
def test_priority(url, priority):
    session = Mock()
    MPEGDASH.bind(session, "tests.plugins.test_dash")
    assert next(
        (matcher.priority
         for matcher in MPEGDASH.matchers if matcher.pattern.match(url)),
        NO_PRIORITY) == priority
예제 #4
0
 def test_stream_weight(self):
     self.assertAlmostEqual(MPEGDASH.stream_weight("720p"), (720, 'pixels'))
     self.assertAlmostEqual(MPEGDASH.stream_weight("1080p"),
                            (1080, 'pixels'))
     self.assertAlmostEqual(MPEGDASH.stream_weight("720p+a128k"),
                            (720 + 128, 'pixels'))
     self.assertAlmostEqual(MPEGDASH.stream_weight("720p+a0k"),
                            (720, 'pixels'))
     self.assertAlmostEqual(MPEGDASH.stream_weight("a128k"),
                            (128 / BIT_RATE_WEIGHT_RATIO, 'bitrate'))
예제 #5
0
 def test_priority(self):
     self.assertEqual(MPEGDASH.priority("http://example.com/fpo.mpd"),
                      LOW_PRIORITY)
     self.assertEqual(
         MPEGDASH.priority("dash://http://example.com/foo.mpd"),
         NORMAL_PRIORITY)
     self.assertEqual(MPEGDASH.priority("dash://http://example.com/bar"),
                      NORMAL_PRIORITY)
     self.assertEqual(MPEGDASH.priority("http://example.com/bar"),
                      NO_PRIORITY)
예제 #6
0
 def test_get_streams(self, parse_manifest):
     p = MPEGDASH("http://example.com/foo.mpd")
     p.bind(self.session, 'dash')
     p.streams()
     parse_manifest.assert_called_with(self.session, "http://example.com/foo.mpd")
예제 #7
0
 def test_can_handle_url_negative(self):
     # shouldn't match
     self.assertFalse(MPEGDASH.can_handle_url("http://www.tvcatchup.com/"))
     self.assertFalse(MPEGDASH.can_handle_url("http://www.youtube.com/"))
예제 #8
0
def test_get_streams(parse_manifest, url, expected):
    session = Mock()
    MPEGDASH.bind(session, "tests.plugins.test_dash")
    p = MPEGDASH(url)
    p.streams()
    parse_manifest.assert_called_with(session, expected)
예제 #9
0
 def test_get_streams(self, parse_manifest):
     p = MPEGDASH("http://example.com/foo.mpd")
     p.bind(self.session, 'dash')
     p.streams()
     parse_manifest.assert_called_with(self.session, "http://example.com/foo.mpd")
예제 #10
0
 def test_stream_weight(self):
     self.assertAlmostEqual(MPEGDASH.stream_weight("720p"), (720, 'pixels'))
     self.assertAlmostEqual(MPEGDASH.stream_weight("1080p"), (1080, 'pixels'))
     self.assertAlmostEqual(MPEGDASH.stream_weight("720p+a128k"), (720+128, 'pixels'))
     self.assertAlmostEqual(MPEGDASH.stream_weight("720p+a0k"), (720, 'pixels'))
     self.assertAlmostEqual(MPEGDASH.stream_weight("a128k"), (128 / BIT_RATE_WEIGHT_RATIO, 'bitrate'))
예제 #11
0
 def test_priority(self):
     self.assertEqual(MPEGDASH.priority("http://example.com/fpo.mpd"), LOW_PRIORITY)
     self.assertEqual(MPEGDASH.priority("dash://http://example.com/foo.mpd"), NORMAL_PRIORITY)
     self.assertEqual(MPEGDASH.priority("dash://http://example.com/bar"), NORMAL_PRIORITY)
     self.assertEqual(MPEGDASH.priority("http://example.com/bar"), NO_PRIORITY)
예제 #12
0
 def test_can_handle_url_negative(self):
     # shouldn't match
     self.assertFalse(MPEGDASH.can_handle_url("http://www.tvcatchup.com/"))
     self.assertFalse(MPEGDASH.can_handle_url("http://www.youtube.com/"))
예제 #13
0
 def test_can_handle_url(self):
     # should match
     self.assertTrue(MPEGDASH.can_handle_url("http://example.com/foo.mpd"))
     self.assertTrue(MPEGDASH.can_handle_url("dash://http://www.testing.cat/directe"))
     self.assertTrue(MPEGDASH.can_handle_url("dash://https://www.testing.cat/directe"))