def open_google(var,window,var1):
    var.set('What are you looking for ? ')
    window.update()
    st.respond('What are you looking for ? ')
    query = st.listen()
    var1.set(query)
    window.update()
    webbrowser.open(f'https://www.google.com.tr/search?q={query}')
def open_youtube(var,window,var1):
    var.set('What are you looking for ? ')
    window.update()
    st.respond('What are you looking for ? ')
    query = st.listen()
    var1.set(query)
    window.update()
    webbrowser.open(f'https://www.youtube.com/results?search_query={query}')
예제 #3
0
def show_note(var,window):
    var.set("Showing Notes")
    window.update()
    st.respond("Showing Notes")
    file = open("iris.txt", "r")
    var.set(file.read())
    window.update()
    print(file.read())
    st.respond(file.read(6))
예제 #4
0
def send_sms():
    try:
        accounts = {'a': '+962785144005', 's': '+962785191344'}

        st.respond('enter a name ')
        name = st.listen().lower()
        sms_to = accounts[name[0]]
        get_msg(sms_to)
    except Exception:
        send_sms()
예제 #5
0
def send_email(var, window, var1):
    try:
        var.set("What should I say?")
        window.update()
        st.respond("What should I say?")
        content = st.listen()
        var1.set(content)
        window.update()
        # var.set("whome should I send")
        # window.update()
        whome_send(content, var, window, var1)
    except Exception:
        send_email(var, window, var1)
예제 #6
0
def read_book(var, window):
    var.set("Here you go to book shelf\n")
    window.update()
    st.respond("Here you go to book shelf\n")
    book = askopenfilename()
    reader = PyPDF2.PdfFileReader(book)
    pages = reader.numPages
    for num in range(0, pages):
        page = reader.getPage(num)
        text = page.extractText()
        player = pyttsx3.init()
        voices = player.getProperty('voices')
        player.setProperty('voice', voices[1].id)
        newVoiceRate = 145
        player.setProperty('rate', newVoiceRate)
        player.say(text)
        player.runAndWait()
예제 #7
0
def write_note(var,window,var1):
    var.set("What should i write, sir")
    window.update()
    st.respond("What should i write, sir")
    note = st.listen()
    var1.set(note)
    window.update()
    file = open('iris.txt', 'w')
    var.set("Sir, Should i include date and time")
    window.update()

    strTime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
    file.write(strTime)
    file.write(" :- ")
    file.write(note)
    st.respond("The Note have Been saved")
    var.set("The Note have Been saved")
    window.update()
예제 #8
0
def whome_send(content, var, window, var1):
    try:
        st.respond("whome should I send")
        to = st.listen()[0].lower()
        while to not in contacts:
            st.respond("i could not find the contact !")
            to = st.listen()[0].lower()
        sendEmail(contacts[to], content)
        st.respond("Email has been sent !")

    except Exception as e:
        print(e)
        var.set("I am not able to send this email")
        window.update()
        st.respond("I am not able to send this email")
        whome_send(content, var, window, var1)
def get_time(var,window):
    var.set(ctime())
    window.update()
    st.respond(ctime())
def get_joke(var,window):
    joke = pyjokes.get_joke()
    var.set(joke)
    window.update()
    st.respond(joke)
    st.respond('hahahaha')
예제 #11
0
def digital_assistant(data):

    if "who are you" in data:
        var1.set(data)
        window.update()
        var.set("I am Iris, Your pretty intelligent assistant")
        window.update()
        st.respond("I am Iris, Your pretty intelligent assistant")
    elif 'good morning' in data:
        var1.set(data)
        window.update()
        var.set("Good morning dear")
        st.respond("Good morning dear")
        window.update()

    elif "time" in data:
        var1.set(data)
        window.update()
        gf.get_time(var,window)

    elif 'youtube' in data:
        var1.set(data)
        window.update()
        gf.open_youtube(var,window,var1)

    elif 'google' in data:
        var1.set(data)
        window.update()
        gf.open_google(var,window,var1)

    elif "write" in data:
        var1.set(data)
        window.update()
        nf.write_note(var,window,var1)


    elif "show" in data:
        var1.set(data)
        window.update()
        nf.show_note(var,window)

    elif 'joke' in data:
        var1.set(data)
        window.update()
        gf.get_joke(var,window)


    elif 'book' in data:
        var1.set(data)
        window.update()
        bf.read_book(var,window)


    elif 'weather' in data:
        var1.set(data)
        window.update()
        Key = '71b466b89b734b6d8c5566794767010f'
        city_name = 'amman'
        url = f'https://api.weatherbit.io/v2.0/forecast/daily?city={city_name}&key={Key}'
        get_info_as_Json = requests.get(url).json()
        description = get_info_as_Json['data'][0]['weather']['description']
        tempreture=get_info_as_Json['data'][0]['high_temp']
        var.set(f'the weather in {city_name} is {description} and the temprature is {tempreture}C.')
        window.update()
        st.respond(f'the weather in {city_name} is {description} and the temprature is {tempreture}C.')


    elif 'email' in data:
        var1.set(data)
        window.update()
        se.send_email(var,window,var1)

    elif 'sms' in data:
        var1.set(data)
        window.update()
        sf.send_sms()

    elif 'image' in data:
        var1.set(data)
        window.update()
        azure_a.read_image_text()

    elif "stop" in data:
        var1.set(data)
        window.update()
        print('Listening stopped')
        window.destroy()
    else:
        st.respond("Sorry! can you repeat .. ")
        data = st.listen().lower()
        digital_assistant(data)
예제 #12
0
def get_msg(sms_to):
    st.respond('enter a msg')
    massage = st.listen()
    print(massage, '22')
    send_msg(massage, sms_to)