def reset_score(self) -> None: self.red_score_settings['text'] = '0' self.blue_score_settings['text'] = '0' self.call( obsRequests.SetSourceSettings( self.RED_SCORE_SOURCE_NAME, sourceSettings=self.red_score_settings)) self.call( obsRequests.SetSourceSettings( self.BLUE_SCORE_SOURCE_NAME, sourceSettings=self.blue_score_settings))
def load_video(self, filename: str) -> None: with self.websocket as websocket: websocket.call( requests.SetSourceSettings( self.source_name, { 'local_file': filename, 'looping': False, 'restart_on_activate': False, 'clear_on_media_end': False, }, )) websocket.call( requests.SetSceneItemProperties( {'name': self.source_name}, # Setting the bounds here means that the media will fill the canvas, # preserving its aspect ratio. bounds={ 'type': 'OBS_BOUNDS_SCALE_INNER', 'x': self.video_info.getBaseWidth(), 'y': self.video_info.getBaseHeight(), }, )) websocket.call(requests.PlayPauseMedia(self.source_name, PAUSE)) websocket.call(requests.ScrubMedia(self.source_name, 0)) websocket.call(requests.SetCurrentScene(self.scene_name))
def display_score(self, team, score) -> None: print('obs.display_score') if team == 'red': print('obs.display_score.red') self.red_score_settings['text'] = str(score) self.call( obsRequests.SetSourceSettings( self.RED_SCORE_SOURCE_NAME, sourceSettings=self.red_score_settings)) if team == 'blue': print('obs.display_score.blue') self.blue_score_settings['text'] = str(score) self.call( obsRequests.SetSourceSettings( self.BLUE_SCORE_SOURCE_NAME, sourceSettings=self.blue_score_settings))
def OBS_SetCamUrl(url): falcon_logger.info("Configurando camara OBS en %s" % url) ws = obsws(host, port, password) try: ws.connect() except: return 1,"Error de Conexion - ¿OBS Parado?)" settings= {'playlist': \ [ {'hidden': False, 'selected': False, 'value': url } ] } ws.call(requests.SetSourceSettings(sourceSettings=settings,sourceName=config.OBS.SOURCE_NAME,sourceType=config.OBS.SOURCE_TYPE)) falcon_logger.info("Camara configurada.") ws.disconnect()
def set_section(self, title: Optional[str] = None, byline: Optional[str] = None, guest_1_title: Optional[str] = None, guest_2_title: Optional[str] = None, b_roll: Optional[str] = None): if title is not None: self.conn.call( requests.SetTextFreetype2Properties("Interview bottom title", text=title or "")) if byline is not None: self.conn.call( requests.SetTextFreetype2Properties( "Interview bottom title line 2", text=byline or "")) if guest_1_title is not None: self.conn.call( requests.SetTextFreetype2Properties( "Interview - lower third guest 1", text=guest_1_title or "")) if guest_2_title is not None: self.conn.call( requests.SetTextFreetype2Properties( "Interview - lower third guest 2", text=guest_2_title or "")) if b_roll: self.conn.call( requests.SetSourceSettings(sourceName="b-roll", sourceType=FFMPEG_SOURCE, sourceSettings=dict( setVisible=True, local_file=b_roll, )))
if (nombre=="Fuente de vídeo VLC"): print("\n\n Resource") print(resource) sett=ws.call(requests.GetSourceSettings(nombre)) # print("\n\n Settings \n",sett,"\n\n") """ req= {'sourceName': nombre, 'sourceType': 'vlc_source', 'sourceSettings': """ settings= {'playlist': \ [ {'hidden': False, 'selected': False, 'value': "rtsp://192.168.1.110:554/1/h264major" } ] } print("\n\ Pido: \n") print(sett) sett=ws.call(requests.SetSourceSettings(sourceSettings=settings,sourceName=nombre,sourceType='vlc_source')) print("\n\nDevuelve\n") print(sett) ws.disconnect()
def set_text(self, name, msg): self.ws.call(requests.SetSourceSettings(name, {'text': msg}))
def set_sound_vol(self, vol): # vol = 0~5 file = path + '\\image\\vol_{}.png'.format(str(vol)) self.ws.call( requests.SetSourceSettings('sound', sourceSettings={'file': file}))