Exemplo n.º 1
0
def __update__():
    m_f.api_other_write("func", m_f.api_other("func"))
    m_f.api_other_write("answers", m_f.api_other("answers"))
    m_f.say("обнавила")
    time.sleep(1)
    m_f.restart()
    return 0
Exemplo n.º 2
0
def __close_all__():
    import sys
    m_f.log(wr='Close all')
    m_f.log(cl=1)
    m_f.say('пока')
    interrupt.stop()
    sys.exit(0)
    return 0
Exemplo n.º 3
0
def paragraph(name):
    try:
        #print(wiki.summary(name,sentences=4))
        m_f.say_wiki(wiki.summary(name, sentences=2))
    except:
        m_f.say("такой стати не существует")
        time.sleep(1)
        m_f.say("попробую найти")
        search(name)
    return 0
Exemplo n.º 4
0
def __anecdote__():
    anecdote = m_f.txt_read_dict('anecdote.txt')
    anec = random.choice(list(anecdote.items()))
    m_f.say(anec[1])
    time.sleep(2)
    m_f.say('нравиться?')

    rec = m_f.stand_text(str(m_f.__rec__()))
    print(rec)
    if (rec != 'да' and rec != 'очень' and rec != 'класс' and rec != 'круто'):
        print("yes")
        anecdote.pop(anec[0])
        m_f.txt_write('anecdote.txt', anecdote)
    del anecdote
    return 0
Exemplo n.º 5
0
def __sayDate__():
    months_ru = {
        "01": "Январь",
        "02": "Февраль",
        "03": "Март",
        "04": "Апрель",
        "05": "Май",
        "06": "Июнь",
        "07": "Июль",
        "08": "Август",
        "09": "Сентябрь",
        "10": "Октябрь",
        "11": "Ноябрь",
        "12": "Декабрь"
    }
    say = "день {}{}{}".format(time.strftime('%d'), ", месяц, ",
                               months_ru[time.strftime('%m')])
    m_f.say(say)
    os.remove("mp3/{}{}".format(m_f.ru_to_en(say), ".mp3"))
    return 0
Exemplo n.º 6
0
def search(name):
    result = wiki.search(name)
    if len(result) > 0:
        loop = len(result) if len(result) < 4 else 4
        m_f.say("я нашла несколько статей")
        for l in range(1, loop):
            m_f.say(result[l])
        m_f.say("какой из них тебе нужен?")
        rec = input(" - ")
        parag = result[1] if rec == "первый" else result[
            2] if rec == "второй" else result[
                3] if rec == "третий" or rec == "последный" else 0
        if parag == 0:
            m_f.say("хорошо")
            return 0

        paragraph(parag)
        return 0
    else:
        m_f.say("Прости нечего не смогла найти")

    return 0
Exemplo n.º 7
0
def main():
    global start
    global t
    global hand_mode
    global asked
    if start:
        if int(time.strftime('%H')) >= 23 and hand_mode and not asked:
            asked = True
            m_f.say("Включить? ночной режим")
            #rec = m_f.stand_text(str(m_f.__rec__()))
            rec = input(" - ")
            if rec == "да" or rec == "конечно":
                hand_mode = False
                m_f.say("хорошо")
            else:
                hand_mode = True
                m_f.say("как хочешь")
        t = threading.Timer(30 * 60.0, main)
        t.start()
        if not hand_mode:
            #all interrupt functions
            if int(time.strftime('%H')) >= 23:
                m_f.dont_say = 1
Exemplo n.º 8
0
def __sayTime__():
    say = "сейчас {}{}{}{}".format(time.strftime('%H'), " часов ",
                                   time.strftime('%M'), " минут")
    m_f.say(say)
    os.remove("mp3/{}{}".format(m_f.ru_to_en(say), ".mp3"))
    return 0
Exemplo n.º 9
0
def __howOld__():
    year = time.strftime('%y') if int(
        time.strftime('%W')) >= 48 else int(time.strftime('%y')) - 1
    m_f.say("мне {}{}".format(year, " лет"))
    return 0
Exemplo n.º 10
0
def __door_close__():
    m_f.log(wr='Door is closed')
    m_f.status_update(1, 0)
    m_f.say('дверь закрыта')
    return 0
Exemplo n.º 11
0
def __door_open__():
    m_f.log(wr='Door is opend')
    m_f.status_update(1, 1)
    m_f.say('дверь открыта')
    return 0
Exemplo n.º 12
0
def __light_OFF__():
    m_f.log(wr='Light is OFF')
    m_f.status_update(4, 0)
    m_f.say('выключила')
    return 0
Exemplo n.º 13
0
def __night__():
    interrupt.hand_mode = True
    m_f.say("отключила")
    return 0
Exemplo n.º 14
0
def __forecast__():
    forecast.weather_forecast()
    m_f.say("завтра ожидается от {} до {} градусов {}".format(
        forecast.low, forecast.high,
        "тепла" if forecast.low > 0 else "мароза"))
Exemplo n.º 15
0
def __weather__():
    forecast.measure()
    m_f.say("сийчас {} градусов, а влажность {}".format(
        forecast.temp, forecast.hum))
Exemplo n.º 16
0
def __light_ON__():
    m_f.log(wr='Light is ON')
    m_f.status_update(4, 1)
    m_f.say('включила')
    return 0