def to_system_time(dt): LOG.warning("This method is depreciated, use location_utils.to_system_time() directly") return to_system_time(dt)
def newest_file_in_dir(path, ext=None): LOG.warning("This method is depreciated, use file_utils.get_most_recent_file_in_dir() directly") return get_most_recent_file_in_dir(path, ext)
def request_from_mobile(message): LOG.warning("This method is depreciated, use message_utils.request_from_mobile() directly") return request_from_mobile(message)
def location_timezone(self) -> str: """Get the timezone code, such as 'America/Los_Angeles'""" LOG.warning("This method does not support user-specific location and will use device default") return self.preference_location()["tz"]
def speak(self, utterance, expect_response=False, wait=False, meta=None, message=None, private=False, speaker=None): """ Speak a sentence. Arguments: utterance (str): sentence mycroft should speak expect_response (bool): set to True if Mycroft should listen for a response immediately after speaking the utterance. message (Message): message associated with the input that this speak is associated with private (bool): flag to indicate this message contains data that is private to the requesting user speaker (dict): dict containing language or voice data to override user preference values wait (bool): set to True to block while the text is being spoken. meta: Information of what built the sentence. """ # registers the skill as being active meta = meta or {} meta['skill'] = self.name self.enclosure.register(self.name) if utterance: if not message: # Find the associated message LOG.debug('message is None.') message = dig_for_message() if not message: message = Message("speak") if not speaker: speaker = message.data.get("speaker", None) nick = get_message_user(message) if private and self.server: LOG.debug("Private Message") title = message.context["klat_data"]["title"] need_at_sign = True if title.startswith("!PRIVATE"): users = title.split(':')[1].split(',') for idx, val in enumerate(users): users[idx] = val.strip() if len(users) == 2 and "Neon" in users: need_at_sign = False elif len(users) == 1: need_at_sign = False elif nick.startswith("guest"): need_at_sign = False if need_at_sign: LOG.debug("Send message to private cid!") utterance = f"@{nick} {utterance}" data = {"utterance": utterance, "expect_response": expect_response, "meta": meta, "speaker": speaker} if message.context.get("cc_data", {}).get("emit_response"): msg_to_emit = message.reply("skills:execute.response", data) else: message.context.get("timing", {})["speech_start"] = time.time() msg_to_emit = message.reply("speak", data, message.context) LOG.debug(f"Skill speak! {data}") LOG.debug(msg_to_emit.msg_type) self.bus.emit(msg_to_emit) else: LOG.warning("Null utterance passed to speak") LOG.warning(f"{self.name} | message={message}") if wait: wait_while_speaking()
def ngi_settings(self): LOG.warning("This reference is depreciated, use self.preference_skill for per-user skill settings") return self._ngi_settings
def configuration_available(self): LOG.warning("This reference is deprecated, use self.local_config directly") return self.local_config.content
def user_info_available(self): LOG.warning("This reference is deprecated, use self.preference_x methods for user preferences") return self.user_config.content
def speak(utterance, expect_response=False, wait=False, meta=None, message=None, private=False, speaker=None): """ Speak a sentence. Arguments: utterance (str): sentence mycroft should speak expect_response (bool): set to True if Mycroft should listen for a response immediately after speaking the utterance. message (Message): message associated with the input that this speak is associated with private (bool): flag to indicate this message contains data that is private to the requesting user speaker (dict): dict containing language or voice data to override user preference values wait (bool): set to True to block while the text is being spoken. meta: Information of what built the sentence. """ from neon_utils import SKILL # registers the skill as being active meta = meta or {} meta['skill'] = SKILL.name SKILL.enclosure.register(SKILL.name) if utterance: LOG.debug(f">>>>> Skill speak! {utterance}") # Find the associated message if message: LOG.info('message passed to speak = ' + str(message.data)) if not speaker: speaker = message.data.get("speaker", None) else: LOG.debug('message is None.') message = dig_for_message() if message: # filename = message.context.get("flac_filename", "") # cc_data = message.context.get("cc_data", {}) # profiles = message.context.get("nick_profiles", {}) if not speaker: speaker = message.data.get("speaker", speaker) # if message.data['flac_filename']: # filename = message.data['flac_filename'] # else: # filename = '' else: message = dig_for_message() filename = '' # cc_data = {} # profiles = {} if message: # filename = message.context.get("flac_filename", "") # cc_data = message.context.get("cc_data", {}) # profiles = message.context.get("nick_profiles", {}) if not speaker: speaker = message.data.get("speaker", {}) # registers the skill as being active # print(f'{cc_data} is cc_data') # self.enclosure.register(self.name) nick = "" # LOG.debug(nick) data = { "utterance": utterance, "expect_response": expect_response, "meta": meta, "speaker": speaker } # devices might not want to do these logs either... weird characters cause a logging error if not SKILL.server: LOG.info(f'{speaker} Speak: {utterance}') # LOG.info('Speak data = ' + str(data)) # LOG.info(filename) if not message: message = dig_for_message() if message and message.context.get("cc_data", {}).get("emit_response"): LOG.debug(f"DM: {data}") msg_to_emit = message.reply("skills:execute.response", data) elif message and message.msg_type != "mycroft.ready": message.context.get("timing", {})["speech_start"] = time.time() LOG.info("message True, " + str(data)) # LOG.info(message) # TODO: This is where we have the most complete timing profile for an utterance # LOG.debug(f"TIME: to_speak, {time.time()}, {message.context['flac_filename']}, {data['utterance']}, " # f"{message.context}") # self.bus.emit(message.reply("speak", data)) msg_to_emit = message.reply("speak", data) LOG.debug(f">>>> Skill speak! {data}, {message.context}") else: LOG.warning("message False, " + str(data)) # self.bus.emit(Message("speak", data)) msg_to_emit = Message("speak", data) LOG.debug(msg_to_emit.msg_type) SKILL.bus.emit(msg_to_emit) else: LOG.warning("Null utterance passed to speak") LOG.warning(f"{SKILL.name} | message={message}") if wait: wait_while_speaking()
# Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # 3. Neither the name of the copyright holder nor the names of its # contributors may be used to endorse or promote products derived from this # software without specific prior written permission. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from neon_utils.logger import LOG from ovos_plugin_manager.wakewords import OVOSWakeWordFactory as HotWordFactory LOG.warning("This reference is deprecated; import directly from: " "ovos_plugin_manager.wakewords")