def test_connect(): ws.call(requests.StartStopStreaming()) stream = ws.call(requests.GetStreamingStatus()) emit('data', { 'livestate': stream.getStreaming(), 'recordstate': stream.getRecording() })
def CambiarEnVivo(self, opciones=None): """Envia solisitud de cambiar estado del Streaming .""" if self.Conectado: logger.info("Cambiando estado EnVivo") self.OBS.call(requests.StartStopStreaming()) else: logger.info("OBS no Conectado") self.Notificar("OBS No Conectado")
def streamingControl(address): controlType = removePrefix(address, '/streaming/') if controlType == 'start': ws.call(requests.StartStreaming()) elif controlType == 'stop': ws.call(requests.StopStreaming()) elif controlType == 'toggle': ws.call(requests.StartStopStreaming())
async def countdown(self, ctx: Context): def write_countdown_html(): args = ctx.message.content.split()[1:] parts = tuple(int(x) for x in args[0].split(':')) if len(parts) == 2: m, s = parts m, s = parts # noinspection PyShadowingNames delta = datetime.timedelta(minutes=m, seconds=s) dt = datetime.datetime.now() + delta elif len(parts) == 3: h, m, s = parts dt = datetime.datetime.now().replace(hour=h, minute=m, second=s) else: self.botlogger.error("Invalid call to countdown: {0}".format( args[0])) return self.bot.countdown_to = dt with codecs.open(self.htmlfile.replace('html', 'template'), encoding='UTF-8') as f: lines = f.read() lines = lines.replace('@@date@@', dt.isoformat()) with codecs.open(self.htmlfile, 'w', encoding='UTF-8') as f: f.write(lines) if not self.bot.check_sender(ctx, 'iarspider'): return if not self.ws: return res: obsws_requests.GetStreamingStatus = self.ws.call( obsws_requests.GetStreamingStatus()) if res.getStreaming(): self.logger.error('Already streaming!') return write_countdown_html() self.ws.call(obsws_requests.DisableStudioMode()) # Refresh countdown self.ws.call(obsws_requests.SetCurrentScene('Starting')) try: self.ws.call( obsws_requests.SetMute(self.aud_sources.getMic2(), True)) except KeyError: self.logger.warning("[WARN] Can't mute mic-2, please check!") self.ws.call(obsws_requests.SetMute(self.aud_sources.getMic1(), True)) self.ws.call(obsws_requests.EnableStudioMode()) self.ws.call(obsws_requests.StartStopStreaming()) time.sleep(1) self.ws.call(obsws_requests.PauseRecording()) # self.get_player() # self.player_play_pause() self.ws.call(obsws_requests.SetMute(False, 'Радио')) asyncio.ensure_future( ctx.send('Начат обратный отсчёт до {0}!'.format( self.bot.countdown_to.strftime('%X')))) asyncio.ensure_future(self.bot.my_run_commercial(self.bot.user_id)) self.logger.info("Getting Discord cog...") discord_bot = self.bot.get_cog('DiscordCog') if discord_bot: self.logger.info("Got it, requesting announce...") asyncio.ensure_future(discord_bot.announce()) else: self.logger.warning("Discord cog not found")
def StartStopStreaming(self): try: self.ws.call(requests.StartStopStreaming()) except Exception as e: print(e)
def stop_stream(ws, args): response = ws.call(requests.GetStreamingStatus()) if response.getStreaming(): ws.call(requests.StartStopStreaming())
def CambiarStriming(self): if self.OBSConectado: print("Cambiando estado Striming") self.ConeccionOBS.call(requests.StartStopStreaming()) else: print("No se encontro OBS")
def Streaming_Toggle(self, *args, **kwargs): try: self.ws.call(requests.StartStopStreaming()) PrintWithTime(f"Toggled streaming") except Exception as e: PrintWithTime(f"Couldn't toggle streaming. Error : {e}")