def _wscb_get(self, channel, message): """ Callback for the get operation :param channel: The name of the channel containing the get request :type channel: str :param message: The message received over the channel :type message: dict -- not used """ # Array version of variable variable_arr = self._get_variable_from_channel(channel) # Joined string version of variable variable = ".".join(variable_arr) # Dispatch for specific elements # Medias are not stored internally if variable == 'medias': value = MediaManager.get_all() elif variable in [ 'medias.audio', 'medias.video', 'medias.image', 'medias.scenario' ]: value = MediaManager.get(variable.split('.')[1]) else: # Internal value, handled by us value = self._get_struct(variable_arr, self._store) logging.debug("got get request for value %s, sending back value %s" % (variable, value)) return_channel = "storage.event.%s" % variable self._ws.send(return_channel, {'value': value})
def _wscb_get(self, channel, message): """ Callback for the get operation :param channel: The name of the channel containing the get request :type channel: str :param message: The message received over the channel :type message: dict -- not used """ # Array version of variable variable_arr = self._get_variable_from_channel(channel) # Joined string version of variable variable = ".".join(variable_arr) # Dispatch for specific elements # Medias are not stored internally if variable == 'medias': value = MediaManager.get_all() elif variable in ['medias.audio', 'medias.video', 'medias.image', 'medias.scenario']: value = MediaManager.get(variable.split('.')[1]) else: # Internal value, handled by us value = self._get_struct(variable_arr, self._store) logging.debug("got get request for value %s, sending back value %s" % (variable, value)) return_channel = "storage.event.%s" % variable self._ws.send(return_channel, { 'value': value })
def _autostart_scenarios(self): """ Advertises scenarios that have to run at start """ for sc in json.loads(MediaManager.get('scenario')): if 'autostart' in sc and sc['autostart'] == True: self._start_scenario(sc)
def get(self, target): self.write(MediaManager.get(target))