def test_connect(): stream = ws.call(requests.GetStreamingStatus()) # print(stream.getRecording()) vol = ws.call(requests.GetSourcesList()) print(vol) emit('data', {'livestate': stream.getStreaming(),'recordstate': stream.getRecording()})
def __init__(self, host='localhost', port=4444, password='', verbose=False): self.connection = obsws(host, port, password) self.connection.register(self.on_event) self.connection.connect() if verbose: sources = self.connection.call( requests.GetSourcesList()).getSources() print('Sources detected:') for source in sources: print(' - {}'.format(source['name']))
elif filter <= 59: ws.call( requests.SetCurrentScene(ScenesNames[0]) ) # COntrol sources by using sourceSwitch("source_Name","Scene_name", bool) #sourceSwitch("screen1","Scene1",False) print("\n [{0}] +" " + {1}".format(args[0], filter)) if __name__ == "__main__": try: scenes = ws.call(requests.GetSceneList()) for s in scenes.getScenes(): name = s['name'] print( ws.call(requests.GetSourcesList()), "\n") # Get The list of available sources in each scene in OBS ScenesNames.append(name) # Add every scene to a list of scenes print("\n CURRENT SCENES IN OBS", ScenesNames) ### OSC SETTINGS parser = argparse.ArgumentParser() parser.add_argument("--ip", default="127.0.0.1", help="The ip to listen on") parser.add_argument("--port", type=int, default=5005, help="The port to listen on")
def ListSources(self): try: return self.ws.call( requests.GetSourcesList()).__dict__["datain"]["sources"] except Exception as e: print(e)
def get_media_sources(self): srcs = self.ws_call(requests.GetSourcesList()).getSources() media_src_types = ("vlc_source", "ffmpeg_source") media_sources = [x for x in srcs if x['typeId'] in media_src_types] logging.debug(f"OBS command: get media sources.\n{media_sources}") return media_sources
def getSourceList(self): sources = self.ws.call(requests.GetSourcesList()) for each in sources.getSources(): logging.info(each) sourceListLong.append(each) sourceListShort.append(each["name"])