Beispiel #1
0
def SwitchScene(Action, ws):
    #Here we check whether StudioMode is on
    StudioState = CheckStudioState(ws)

    if StudioState == True:
        #Here we set the preview scene
        try:
            ws.call(requests.SetPreviewScene(Action["DestinationScene"]))
        except:
            print("Couldn't set " + Action["DestinationScene"] + " to program")
        else:
            PrintWithTime("Set " + Action["DestinationScene"] + " to program")
    else:
        #Here we set the configured transition mode
        if "Transition" in Action:
            Transition_old = GetTransition(ws)
            SetTransition(Action, ws)
        #Here we set the scene being viewed
        try:
            ws.call(requests.SetCurrentScene(Action["DestinationScene"]))
        except:
            print("Couldn't set " + Action["DestinationScene"] + " to program")
        else:
            PrintWithTime("Set " + Action["DestinationScene"] + " to program")
        #Here we set the transition mode back
        if "Transition" in Action:
            try:
                Duration = ws.call(requests.GetTransitionDuration())
                Duration = Duration.getTransitionDuration()
            except:
                print("Couldn't get transition duration")
            else:
                time.sleep(Duration / 1000 + 0.1)
            finally:
                SetTransition(Transition_old, ws)
Beispiel #2
0
def TransitionToProgram(Action, ws):
    #Here we check whether StudioMode is on
    StudioState = CheckStudioState(ws)
    #Here we make the transition
    if StudioState == True:
        #Here we set the configured transition mode
        if "Transition" in Action:
            Transition_old = GetTransition(ws)
            SetTransition(Action, ws)
        #Here we make the transition
        try:
            CurrentsceneObject = ws.call(requests.GetPreviewScene())
            Currentscene = CurrentsceneObject.getName()
            ws.call(requests.SetCurrentScene(Currentscene))
        except:
            print("Couldn't send preview to program")
        else:
            PrintWithTime("Sent preview to program")
        #Here we set the transition mode back
        if "Transition" in Action:
            try:
                Duration = ws.call(requests.GetTransitionDuration())
                Duration = Duration.getTransitionDuration()
            except:
                print("Couldn't get transition duration")
            else:
                time.sleep(Duration / 1000 + 0.1)
            finally:
                SetTransition(Transition_old, ws)
    else:
        print("StudioMode not enabled")
Beispiel #3
0
 def GetTransitionDuration(self):
     try:
         return self.ws.call(requests.GetTransitionDuration()
                             ).__dict__["datain"]["transition-duration"]
     except Exception as e:
         print(e)