How to use get_current_scene method in ATX

Best Python code snippet using ATX

infinity_feedback_integrator.py

Source:infinity_feedback_integrator.py Github

copy

Full Screen

...19 print(response.code)20 return response212223def get_current_scene(data=""):24 # print("URL: "+url)25 current_scene = obs.obs_frontend_get_current_scene()26 current_scene_name = obs.obs_source_get_name(current_scene)2728 preview_scene = obs.obs_frontend_get_current_preview_scene()29 preview_scene_name = obs.obs_source_get_name(preview_scene)3031 all_scenes = obs.obs_frontend_get_scene_names()32 all_scenes_string = ','.join(all_scenes)333435 opener = urllib.request.build_opener(HttpHandler())36 try:37 base_url = url+"update"38 params = {'key': key, 'all': all_scenes_string, 'active': current_scene_name, 'preview': preview_scene_name}39 thread = threading.Thread(target=opener.open, args=(base_url+"?"+urllib.parse.urlencode(params),))40 thread.start()41 print('exit')4243 except Exception as e:44 print(e)4546 obs.source_list_release(all_scenes)47 obs.obs_source_release(current_scene)48 obs.obs_source_release(preview_scene)4950def show_qr_code(arg1, arg2):51 qr = qrcode.QRCode(52 version=1,53 box_size=8,54 border=1,55 )56 data = {'url':url, 'key':key}57 qr.add_data(json.dumps(data))58 qr.make(fit=True)5960 img = qr.make_image(fill_color="black", back_color="white")61 img.show()626364def create_html_qr_code():65 qr = qrcode.QRCode(66 version=1,67 box_size=4,68 border=1,69 )70 data = {'url':url, 'key':key}71 qr.add_data(json.dumps(data))72 qr.make(fit=True)7374 img = qr.make_image(fill_color="black", back_color="white")7576 buffered = BytesIO()77 img.save(buffered, format="PNG")78 img_str = base64.b64encode(buffered.getvalue())79 img_base64 = "data:image/png;base64," + img_str.decode('ascii') + "="80 img_html = "<img src='"+img_base64+"'/>"81 return img_html8283def propagate_streaming_started():84 print("start stream")85 opener = urllib.request.build_opener(HttpHandler())86 try:87 base_url = url+"update"88 params = {'key': key, 'stream': "true"}89 thread = threading.Thread(target=opener.open, args=(base_url+"?"+urllib.parse.urlencode(params),))90 thread.start()91 print('exit')9293 except Exception as e:94 print(e)9596def propagate_streaming_stopped():97 print("stopped stream")98 opener = urllib.request.build_opener(HttpHandler())99 try:100 base_url = url+"update"101 params = {'key': key, 'stream': "false"}102 thread = threading.Thread(target=opener.open, args=(base_url+"?"+urllib.parse.urlencode(params),))103 thread.start()104 print('exit')105106 except Exception as e:107 print(e)108109def on_event(event):110 if event == obs.OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED :111 get_current_scene()112 elif event == obs.OBS_FRONTEND_EVENT_STREAMING_STARTED :113 propagate_streaming_started()114 elif event == obs.OBS_FRONTEND_EVENT_STREAMING_STOPPED :115 propagate_streaming_stopped()116# ------------------------------------------------------------117118def script_description():119 return "<center><h2>OBS Live Feedback</h2></center> If you hover over the questionmark, next to the Key input you will find a QR Code. Please scan the QR Code to connect the Smartphone App.<br> This Plugin calls the API whenever the active Scene is updated.<br/><br/>Made by Lukas Schreiber"120 121def script_update(settings):122 global url123 global key124 url = obs.obs_data_get_string(settings, "url")125 key = obs.obs_data_get_string(settings, "key")126127def script_properties():128 props = obs.obs_properties_create()129130 first = obs.obs_properties_add_text(props, "url", "URL", obs.OBS_TEXT_DEFAULT)131 second = obs.obs_properties_add_text(props, "key", "Key", obs.OBS_TEXT_DEFAULT)132 obs.obs_property_set_long_description(first, "The Server URL. Here shall be the Server Infrastructure.")133 obs.obs_property_set_long_description(second, "<div> Please scan the QR Code with the App to establish a Connection. Otherwise just type URL and Key.<br><br>"+create_html_qr_code()+"</div>")134 return props135136def script_load(settings):137 sh = obs.obs_get_signal_handler()138 # obs.signal_handler_connect(sh, "source_activate", get_current_scene)139 # obs.signal_handler_connect(sh, "source_deactivate", get_current_scene)140 obs.signal_handler_connect(sh, "source_create", get_current_scene)141 obs.signal_handler_connect(sh, "source_remove", get_current_scene)142143 obs.obs_frontend_add_event_callback(on_event)144145 global url146 global key147 url = obs.obs_data_get_string(settings, "url")148 key = obs.obs_data_get_string(settings, "key")149 ...

Full Screen

Full Screen

app.py

Source:app.py Github

copy

Full Screen

...32 self.ui.bind_action(MainWindow.ACTION_BINDING, self.handle_binding)33 self.ui.bind_action(MainWindow.ACTION_QUIT, self.quit)34 self.ui.start_screen(self.scenario)35 self.ui.input_loop()36 def get_current_scene(self):37 return self.scenario.scenes[self.current_scene_id]38 def get_next_scene(self):39 try:40 next_scene = self.scenario.scenes[self.current_scene_id + 1]41 except IndexError:42 next_scene = None43 return next_scene44 def play_current_scene(self):45 self.ui.show_playing_scene(self.get_current_scene(),46 self.get_next_scene())47 self.get_current_scene().play()48 def stop_current_scene(self):49 self.get_current_scene().stop()50 def next_scene(self):51 self.stop_current_scene()52 self.current_scene_id += 153 try:54 self.play_current_scene()55 except IndexError:56 self.current_scene_id -= 157 def handle_binding(self, sound):58 sound.play_now()59 def quit(self):60 self.stop_current_scene()61def main():62 AmpyentController()63if __name__ == '__main__':...

Full Screen

Full Screen

server.py

Source:server.py Github

copy

Full Screen

...8loop = asyncio.get_event_loop()9app = Flask(__name__)10keyboard = Controller()11WEBSOCKET_SERVER = '192.168.0.180'12def get_current_scene():13 j = json.dumps({14 'request-type': 'GetCurrentScene',15 'message-id': '2',16 })17 r = loop.run_until_complete(webcall(j))18 j = json.loads(r)19 return j['name']20def switch_scene(scene_name):21 j = json.dumps({22 'request-type': 'SetCurrentScene',23 'message-id': '1',24 'scene-name': scene_name,25 })26 loop.run_until_complete(webcall(j))27async def webcall(j):28 uri = "ws://%s:4444" % WEBSOCKET_SERVER29 async with websockets.connect(uri) as websocket:30 await websocket.send(j)31 response = await websocket.recv()32 print(response)33 return response34@app.route('/switchcamera')35def switchcamera():36 view = request.args.get('view', '')37 if view == "topdown":38 switch_scene(app.previous_scene)39 elif view == "microscope":40 app.previous_scene = get_current_scene()41 switch_scene('Microscope scene')42 return 'view=%s' % view...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ATX automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful