def test_filmon_expired_stream(self, url, time): stream = FilmOnHLS(self.session, channel="test") url.return_value = "http://filmon.test.se/test.m3u8" stream.watch_timeout = 0 time.return_value = 1 self.assertEqual(None, stream_to_url(stream)) self.assertRaises(TypeError, stream.to_url)
def test_rtmp_stream(self): stream = RTMPStream(self.session, {"rtmp": "rtmp://test.se/app/play_path", "swfVfy": "http://test.se/player.swf", "swfhash": "test", "swfsize": 123456, "playPath": "play_path"}) expected = "rtmp://test.se/app/play_path playPath=play_path swfUrl=http://test.se/player.swf swfVfy=1" self.assertEqual(expected, stream_to_url(stream)) self.assertEqual(expected, stream.to_url())
def test_filmon_stream(self, url, time): stream = FilmOnHLS(self.session, channel="test") url.return_value = "http://filmon.test.se/test.m3u8" stream.watch_timeout = 10 time.return_value = 1 expected = "http://filmon.test.se/test.m3u8" self.assertEqual(expected, stream_to_url(stream)) self.assertEqual(expected, stream.to_url())
def output_stream_passthrough(plugin, stream): """Prepares a filename to be passed to the player.""" global output title = create_title(plugin) filename = '"{0}"'.format(stream_to_url(stream)) output = PlayerOutput(args.player, args=args.player_args, filename=filename, call=True, quiet=not args.verbose_player, title=title) try: log.info("Starting player: {0}".format(args.player)) output.open() except OSError as err: console.exit("Failed to start player: {0} ({1})", args.player, err) return False return True
def test_akamai_stream(self): stream = AkamaiHDStream(self.session, "http://akamai.test.se/stream") self.assertEqual(None, stream_to_url(stream)) self.assertRaises(TypeError, stream.to_url)
def test_hds_stream(self): stream = HDSStream(self.session, "http://test.se/", "http://test.se/stream.f4m", "http://test.se/stream/1.bootstrap") self.assertEqual(None, stream_to_url(stream)) self.assertRaises(TypeError, stream.to_url)
def test_hls_stream(self): expected = "http://test.se/stream.m3u8" stream = HLSStream(self.session, expected) self.assertEqual(expected, stream_to_url(stream)) self.assertEqual(expected, stream.to_url())
def test_base_stream(self): stream = Stream(self.session) self.assertEqual(None, stream_to_url(stream)) self.assertRaises(TypeError, stream.to_url)
def test_http_stream(self): expected = "http://test.se/stream" stream = HTTPStream(self.session, expected, invalid_arg="invalid") self.assertEqual(expected, stream_to_url(stream)) self.assertEqual(expected, stream.to_url())