Пример #1
0
def OBS_StartStreaming(key,ingestion):
    """Handles GET requests"""
    falcon_logger.info("OBS_StartStreaming")
    falcon_logger.info("Key: %s Ingestion: %s" % (key,ingestion))
    OBS_SetCamUrl(config.OBS.CAM_URL)
    ws = obsws(host, port, password)
    try:
        ws.connect()
    except:
        return 1,"Error de Conexion - ¿OBS Parado? - StartStreaming)"

    falcon_logger.info("Inicio Streaming")

    stream_settings = {
        "server":ingestion,
        "key":key,
        "use_auth":False
    }
    stream = {
        "settings":stream_settings,
        "type":"rtmp_custom"
    }

    rc=ws.call(requests.StartStreaming(stream))
    falcon_logger.info(rc)
    ws.disconnect()
    return 0,"Ok"
Пример #2
0
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())
Пример #3
0
    def set_stream(self, val=None):
        if val is None:
            val = not self.connection.call(
                requests.GetStreamingStatus()).getStreaming()

        if val == True:
            self.connection.call(requests.StartStreaming())
        else:
            self.connection.call(requests.StopStreaming())
Пример #4
0
def ToggleStream(BUTTONCONF):
    #Here we check whether or not the stream is on
    StreamingState = True
    try:
        StreamingState = ws.call(requests.GetStreamingStatus())
        StreamingState = StreamingState.getStreaming()
    except:
        print("Couldn't get streaming status")

    if StreamingState == True:
        try:
            #Here we turn the stream off
            ws.call(requests.StopStreaming())
            #Here we turn the Led on the midi pad off
            try:
                if "Led" in BUTTONCONF:
                    midi_out.write_short(0x90, BUTTONCONF["Led"], 0)
                else:
                    print("No Led argument in Button config")
            except:
                pass
            #Here we wait for the stream to be turned off
            while StreamingState == True:
                try:
                    StreamingState = ws.call(requests.GetStreamingStatus())
                    StreamingState = StreamingState.getStreaming()
                except:
                    print("Couldn't get streaming status")
            print("Stopped Streaming")
        except:
            print("Couldn't stop stream")
    else:
        try:
            #Here we turn the stream on
            ws.call(requests.StartStreaming())
            #Here we turn the Led on the midi pad on
            try:
                if "Led" in BUTTONCONF:
                    if "LedMode" in BUTTONCONF:
                        midi_out.write_short(0x90, BUTTONCONF["Led"],
                                             BUTTONCONF["LedMode"])
                    else:
                        print("No LedMode argument in Button config")
                else:
                    print("No Led argument in Button config")
            except:
                pass
            #Here we wait for the stream to be turned on
            while StreamingState == False:
                try:
                    StreamingState = ws.call(requests.GetStreamingStatus())
                    StreamingState = StreamingState.getStreaming()
                except:
                    print("Couldn't get streaming status")
            print("Started Streaming")
        except:
            print("Couldn't start stream")
Пример #5
0
def ToggleStream(Action, ws, midi_out):
    #Here we check whether or not the stream is on
    try:
        StreamingState = ws.call(requests.GetStreamingStatus())
        StreamingState = StreamingState.getStreaming()
    except:
        print("Couldn't get streaming status")
    else:
        if StreamingState == True:
            try:
                #Here we turn the stream off
                ws.call(requests.StopStreaming())
            except:
                print("Couldn't stop stream")
            else:
                #Here we turn the Led on the midi pad off
                MidiLed(Action, "off", midi_out)
                #Here we wait for the stream to be turned off
                while StreamingState == True:
                    try:
                        StreamingState = ws.call(requests.GetStreamingStatus())
                        StreamingState = StreamingState.getStreaming()
                    except:
                        print("Couldn't get streaming status")
                        break
                PrintWithTime("Stopped Streaming")
        else:
            try:
                #Here we turn the stream on
                ws.call(requests.StartStreaming())
            except:
                print("Couldn't start stream")
            else:
                #Here we turn the Led on the midi pad on
                MidiLed(Action, "on", midi_out)
                #Here we wait for the stream to be turned on
                while StreamingState == False:
                    try:
                        StreamingState = ws.call(requests.GetStreamingStatus())
                        StreamingState = StreamingState.getStreaming()
                    except:
                        print("Couldn't get streaming status")
                        break
                PrintWithTime("Started Streaming")
Пример #6
0
def TurnStreamOn(Action):
    try:
        #Here we turn the stream on
        ws.call(requests.StartStreaming())
    except:
        PrintError("Couldn't start stream")
    else:
        #Here we turn the Led on the midi pad on
        MidiLed(Action, "on")
        #Here we wait for the stream to be turned on
        StreamingState = False
        while StreamingState == False:
            try:
                StreamingState = ws.call(requests.GetStreamingStatus())
                StreamingState = StreamingState.getStreaming()
            except:
                PrintError("Couldn't get streaming status")
                break
        PrintWithTime("Started Streaming")
Пример #7
0
 def stream_cb(values):
     if values > 0.0:
         self.client.call(requests.StartStreaming())
     else:
         self.client.call(requests.StopStreaming())
     self.osc.answer('/stream', [values])
Пример #8
0
 def StartStreaming(self):
     try:
         self.ws.call(requests.StartStreaming())
     except Exception as e:
         print(e)
 def start_stream(self):
     logging.info("OBS command: start stream.")
     return self.ws_call(requests.StartStreaming())
Пример #10
0
def start_stream():
    ws.call(requests.StartStreaming())
Пример #11
0
    print("Override Status:")
    print(enableOverride)

    try:
        #scenes = ws.call(requests.GetSceneList())
        #for s in scenes.getScenes():
        #    name = s['name']
        #    print(u"Switching to {}".format(name))
        #    ws.call(requests.SetCurrentScene(name))
        #    time.sleep(2)
        print("Started Command Processing")
        if command == "Start Streaming Bool":
            if getStreamStatus == False:
                if currentScene == destinationScene:
                    print("Already running on the correct scene: Starting Stream")
                    ws.call(requests.StartStreaming())
                else:
                    print("Setting scene to destination and starting stream")
                    ws.call(requests.SetCurrentScene(destinationScene))
                    time.sleep(2)
                    ws.call(requests.StartStreaming())
            else:
                print("Stream already running. Command halted.")
        elif command == "Stop Stream":
            ws.call(requests.StopStreaming())
        elif command == "Start Stream":
            ws.call(requests.StartStreaming())
        elif command == "Switch Scene":
            if enableOverride == "True" or getStreamStatus == False:
                ws.call(requests.SetCurrentScene(destinationScene))
            elif enableOverride == "False":
Пример #12
0
from obswebsocket import requests

import settings
from controllers import OBS

obs = OBS(settings.HOST, settings.PORT, settings.PASSWORD)

obs.connect()
# obs._call(requests.SetStreamSettings(type="rtmp_common", settings={"key": settings.DEBUG_STREAM_KEY}, save=False))
print(obs._call(requests.StartStreaming(stream={"settings": {"key": settings.DEBUG_STREAM_KEY, "server": "x"}, "type": "rtmp_common"})))
Пример #13
0
    def start_stream(self):
        if self.is_streaming():
            return True

        res = self._call(requests.StartStreaming())
        return res.status
Пример #14
0
 def Streaming_Start(self, *args, **kwargs):
     try:
         self.ws.call(requests.StartStreaming())
         PrintWithTime(f"Started streaming")
     except Exception as e:
         PrintWithTime(f"Couldn't start streaming. Error : {e}")