def test_video_quality_1080p_not_in_youtube_360_should_raise_value_error( self): with tempfile.TemporaryDirectory() as temp_dir: output = '%s/out.jpg' % (temp_dir) with self.assertRaises(ValueError): pylivecap.safe_capture(YOUTUBE_360_VIDEO, output, quality=VQ.Q1080)
def shootphoto(): print('shootphoto') # gp.take_photo() w = datetime.datetime.now() w = str(w) w = w.replace(" ","") w = w.replace(".","") w = w.replace(":","") global ts ts = w.replace("-","") pylivecap.safe_capture(LINK, "static/"+img+ts+".jpg") message = 'photo shot, please go next step' return render_template('shot.html', message=message)
def shootphoto(): print('shootphoto') # gp.take_photo() w = datetime.datetime.now() w = str(w) w = w.replace(" ","") w = w.replace(".","") w = w.replace(":","") global ts ts = w.replace("-","") pylivecap.safe_capture(LINK, "static/"+img+ts+".jpg") print('photo shot, please go next step') return img+ts
def bench_safe_capture(): with tempfile.TemporaryDirectory() as temp_dir: output = '%s/out.jpg' % (temp_dir) pylivecap.safe_capture(YOUTUBE_VIDEO, output)
import pylivecap L = "https://www.twitch.tv/jchengli" #L = "https://www.youtube.com/watch?v=vCDDYb_M2B4" pylivecap.safe_capture(L, "static/image0.jpg")
def test_not_exist_output_path_should_raise_permission_error(self): with self.assertRaises(PermissionError): pylivecap.safe_capture(YOUTUBE_PTS_LIVESTREAM, '/path/not/exists')
def test_not_support_url_should_raise_no_plugin_error(self): with tempfile.TemporaryDirectory() as temp_dir: output = '%s/out.jpg' % (temp_dir) with self.assertRaises(streamlink.exceptions.NoPluginError): pylivecap.safe_capture('', output)