示例#1
0
 def get_config(self):
     """returns the parsed server-config"""
     confdict = {
         header: dict(section)
         for header, section in dict(Config).items()
     }
     return OkResponse('server_config', json.dumps(confdict))
示例#2
0
 def get_composite_mode_and_video_status(self):
     """retrieves the composite-mode and the video-status
     in a single call"""
     composite_status = self._get_composite_status()
     video_status = self._get_video_status()
     return OkResponse('composite_mode_and_video_status', composite_status,
                       *video_status)
示例#3
0
    def fetch_value(self, key):
        """retrieves a previusly stored value from a user-defined script.
        does not change the state of the voctocore."""
        try:
            value = self.stored_values[key]
        except KeyError:
            value = ""

        return OkResponse('value', key, value)
示例#4
0
    def help(self):
        """displays help-messages for all commands"""
        helplines = []

        helplines.append("Commands:")
        for name, func in ControlServerCommands.__dict__.items():
            if name[0] == '_':
                continue

            if not func.__code__:
                continue

            params = inspect.signature(func).parameters
            params_iter = (str(info) for name, info in params.items())
            next(params_iter)
            params_str = ', '.join(params_iter)

            command_sig = '\t' + name

            if params_str:
                command_sig += ': ' + params_str

            if func.__doc__:
                command_sig += '\n\t\t{}\n'.format('\n\t\t'.join(
                    [line.strip() for line in func.__doc__.splitlines()]
                ))

            helplines.append(command_sig)

        helplines.append('\t' + 'quit / exit')

        helplines.append("\n")
        helplines.append("Source-Names:")
        for source in self.sources:
            helplines.append("\t" + source)

        if Config.getboolean('stream-blanker', 'enabled'):
            helplines.append("\n")
            helplines.append("Stream-Blanker Sources-Names:")
            for source in self.blankerSources:
                helplines.append("\t" + source)

        helplines.append("\n")
        helplines.append("Composition-Modes:")
        for mode in CompositeModes:
            helplines.append("\t" + mode.name)

        return OkResponse("\n".join(helplines))
示例#5
0
    def help(self):
        helplines = []

        helplines.append("Commands:")
        for name, func in ControlServerCommands.__dict__.items():
            if name[0] == '_':
                continue

            if not func.__code__:
                continue

            params = inspect.signature(func).parameters
            params = [str(info) for name, info in params.items()]
            params = ', '.join(params[1:])

            command_sig = '\t' + name

            if params:
                command_sig += ': ' + params

            if func.__doc__:
                command_sig += '\n' + '\n'.join([
                    '\t\t' + line.strip()
                    for line in func.__doc__.splitlines()
                ]) + '\n'

            helplines.append(command_sig)

        helplines.append('\t' + 'quit')

        helplines.append("\n")
        helplines.append("Source-Names:")
        for source in self.sources:
            helplines.append("\t" + source)

        helplines.append("\n")
        helplines.append("Stream-Blanker Sources-Names:")
        for source in self.blankerSources:
            helplines.append("\t" + source)

        helplines.append("\n")
        helplines.append("Composition-Modes:")
        for mode in CompositeModes:
            helplines.append("\t" + mode.name)

        return OkResponse("\n".join(helplines))
示例#6
0
 def get_stream_status(self):
     status = self._get_stream_status()
     return OkResponse('stream_status', *status)
示例#7
0
 def get_composite_mode(self):
     status = self._get_composite_status()
     return OkResponse('composite_mode', status)
示例#8
0
 def get_video(self):
     """gets the current video-status, consisting of the name of
        video-source A and video-source B"""
     status = self._get_video_status()
     return OkResponse('video_status', *status)
示例#9
0
 def restart_source(self, src_name):
     """restarts the specified source"""
     restart_source(src_name)
     return OkResponse('source_restarted', src_name)
示例#10
0
 def get_stream_status(self):
     """gets the current streamblanker-status"""
     status = self._get_stream_status()
     return OkResponse('stream_status', *status)
示例#11
0
 def get_composite_modes(self):
     """lists the names of all available composite-mode"""
     names = [mode.name for mode in CompositeModes]
     namestr = ','.join(names)
     return OkResponse('composite_modes', namestr)
示例#12
0
 def get_composite_mode(self):
     """gets the name of the current composite-mode"""
     status = self._get_composite_status()
     return OkResponse('composite_mode', status)
示例#13
0
 def get_audio(self):
     """gets the current volumes of the audio-sources"""
     status = self._get_audio_status()
     return OkResponse('audio_status', status)
示例#14
0
 def get_audio(self):
     """gets the name of the current audio-source"""
     status = self._get_audio_status()
     return OkResponse('audio_status', status)
示例#15
0
 def get_config_option(self, section, key):
     """returns a single value from the server-config"""
     value = Config.get(section, key)
     return OkResponse('server_config_option', section, key, value)
示例#16
0
 def get_video(self):
     status = self._get_video_status()
     return OkResponse('video_status', *status)
示例#17
0
 def get_audio(self):
     status = self._get_audio_status()
     return OkResponse('audio_status', status)
示例#18
0
 def get_composite_mode_and_video_status(self):
     composite_status = self._get_composite_status()
     video_status = self._get_video_status()
     return OkResponse('composite_mode_and_video_status',
                       composite_status, *video_status)