Ejemplo n.º 1
0
def __now_i_set_speaker(self, key, prov: dict, speakers: dict, yandex=False):
    if key == prov.get('speaker', 'unset'):
        return Say(F('Я уже {}.', speakers[key]))

    prov['speaker'] = key
    self.cfg.config_save()
    return Say(
        F(
            'Теперь меня зовут {}, а еще я {}.', speakers[key],
            YANDEX_EMOTION.get(self.cfg['yandex'].get('emotion', 'unset'),
                               F('Ошибка')) if yandex else F('без характера')))
Ejemplo n.º 2
0
def __now_i_set_speaker(self, key, prov: dict, speakers: dict, yandex=False):
    if key == prov.get('speaker', 'unset'):
        return Say(LNG['now_already'].format(speakers[key]))

    prov['speaker'] = key
    self.cfg.config_save()
    return Say(LNG['now_i_now'].format(
        speakers[key],
        YANDEX_EMOTION.get(self.cfg['yandex'].get('emotion', 'unset'),
                           LNG['error'])
        if yandex else LNG['now_no_character']))
Ejemplo n.º 3
0
def now_i(self, _, cmd):
    speakers = __tts_selector(self.cfg)
    prov = self.cfg.gts('providertts')
    if speakers is None:
        return Say(F('Не поддерживается для {}', prov))

    if cmd:
        cmd = cmd.lower()
        if prov == 'yandex':
            for key, val in YANDEX_EMOTION.items():
                if cmd == val.lower():
                    return __now_i_set_emo(self, key)
        for key, val in speakers.items():
            if cmd == val.lower():
                return __now_i_set_speaker(self, key, self.cfg[prov], speakers,
                                           prov == 'yandex')
    return Next
Ejemplo n.º 4
0
def now_i(self, _, cmd):
    speakers = __tts_selector(self.cfg)
    prov = self.cfg.gts('providertts')
    if speakers is None:
        return Say(LNG['who_now_no_support'].format(prov))

    if cmd:
        if prov == 'yandex':
            for key, val in YANDEX_EMOTION.items():
                if cmd == val:
                    return __now_i_set_emo(self, key)
        cmd = cmd[0].upper() + cmd[1:]
        for key, val in speakers.items():
            if cmd == val:
                return __now_i_set_speaker(self, key, self.cfg[prov], speakers,
                                           prov == 'yandex')
    return Next
Ejemplo n.º 5
0
 def get_yandex_emo():
     return YANDEX_EMOTION.get(self.cfg.gt('yandex', 'emotion', 'unset'),
                               F('Ошибка'))
Ejemplo n.º 6
0
 def get_yandex_emo():
     return YANDEX_EMOTION.get(self.cfg['yandex'].get('emotion', 'unset'),
                               LNG['error'])