def cam_cb(values): self.osc.answer('/cam', [values]) self.client.call( requests.SetSceneItemProperties('Webcam', visible=values > 0.0)) self.client.call( requests.SetSceneItemProperties('Overlay: Webcam', visible=values > 0.0))
def play_clip(name): ws.call(requests.SetSceneItemProperties(item='clip',visible=False)) time.sleep(0.2) del_file('C:\\Videos\\clip.mp4') copy_file('C:\\Videos\\clips\\'+name+'.mp4' , 'C:\\Videos\\clip.mp4') time.sleep(0.2) clip = MP4('C:\\Videos\\clip.mp4') ws.call(requests.SetSceneItemProperties(item='clip',visible=True)) print("Sleeping for "+str(clip.info.length)) time.sleep(clip.info.length) ws.call(requests.SetSceneItemProperties(item='clip',visible=False))
def now_here(self, msg): if msg: # file = path + 'here.png' self.ws.call(requests.SetSceneItemProperties('here', visible=True)) self.ws.call( requests.SetSceneItemProperties('leave', visible=False)) else: # file = path + 'leave.png' self.ws.call(requests.SetSceneItemProperties('here', visible=False)) self.ws.call(requests.SetSceneItemProperties('leave', visible=True))
async def setup(self, ctx: Context): if not self.bot.check_sender(ctx, 'iarspider'): self.logger.info('Wrong sender!') return if not self.ws: self.logger.info('OBS not present!') return self.ws.reconnect() res: obsws_requests.GetStreamingStatus = self.ws.call( obsws_requests.GetStreamingStatus()) if res.getStreaming(): self.logger.error('Already streaming!') return self.aud_sources = self.ws.call(obsws_requests.GetSpecialSources()) self.ws.call(obsws_requests.SetCurrentProfile('Regular games')) self.ws.call(obsws_requests.SetCurrentSceneCollection('Twitch')) self.ws.call( obsws_requests.SetSceneItemProperties(scene_name="Paused", item="ужин", visible=False)) asyncio.ensure_future(ctx.send('К стриму готов!'))
def toggleState(self, state): visible = not state["current"] for item in state["items"]: self.ws.call( requests.SetSceneItemProperties(item[1], scene_name=item[0], visible=visible))
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 CambiarFuente(self, opciones=False, Fuente=None): """Envia solisitud de Cambia el estado de una fuente.""" if Fuente is None: if "fuente" in opciones: Fuente = opciones["fuente"] if self.Conectado: Estado = ObtenerValor("data/obs_fuente.json", Fuente) if Estado is not None: Estado = not Estado logger.info(f"OBS[Fuente] {Fuente}={Estado}") self.OBS.call(requests.SetSceneItemProperties(Fuente, visible=Estado)) else: logger.warning(f"No se encontro {Fuente[0]} o {Fuente[1]} en OBS") else: logger.info("OBS[no Conectado]") self.Notificar("OBS No Conectado")
def do_pause(self, ctx: Context, is_dinner: bool): # self.get_player() # self.player_play_pause() if self.ws is not None: self.ws.call(obsws_requests.PauseRecording()) self.ws.call( obsws_requests.SetSceneItemProperties(scene_name="Paused", item="ужин", visible=is_dinner)) self.switch_to('Paused') if self.vr: self.ws.call( obsws_requests.SetMute(self.aud_sources.getMic2(), True)) else: self.ws.call( obsws_requests.SetMute(self.aud_sources.getMic1(), True)) self.ws.call(obsws_requests.SetMute(False, 'Радио')) # self.get_chatters() asyncio.ensure_future(ctx.send('Начать перепись населения!')) asyncio.ensure_future(self.bot.my_run_commercial(self.bot.user_id, 60))
def sourceSwitch(source_name, scene, switch): ws.call(requests.SetSceneItemProperties(source_name, scene, visible=switch))
async def enable_rip(self, state): self.ws.call( obsws_requests.SetSceneItemProperties(scene_name="Game", item="RIP", visible=state))
def playOrder(): self.ws.call(requests.SetSceneItemProperties("Order", visible=True)) Timer(3, stopOrder).start()
def stopOrder(): self.ws.call( requests.SetSceneItemProperties("Order", visible=False))
def set_icon_invisible(self, name): self.ws.call(requests.SetSceneItemProperties(name, visible=False))
def sourceSwitch(address): # This function is untested sourceName = removePrefix(address, '/source/') ws.call(requests.SetSceneItemProperties(sourceName, scene, visible=switch))
def CambiarFuente(self, Fuente, Estado): print(f"Cambiando Fuente {Fuente} - {Estado}") self.ConeccionOBS.call( requests.SetSceneItemProperties(Fuente, visible=Estado))