Ejemplo n.º 1
0
 def launchCity(arg):
     speak("Otwieram prognozę pogody.")
     if arg == "krakowie":
         webbrowser.open_new_tab(
             "https://duckduckgo.com/?q=weather+krak%C3%B3w&t=ffab&ia=weather"
         )
     elif arg == "kraków":
         webbrowser.open_new_tab(
             "https://duckduckgo.com/?q=weather+krak%C3%B3w&t=ffab&ia=weather"
         )
     elif arg == "warszawie":
         webbrowser.open_new_tab(
             "https://duckduckgo.com/?q=weather+warszawa&t=ffab&ia=weather")
     elif arg == "warszawa":
         webbrowser.open_new_tab(
             "https://duckduckgo.com/?q=weather+warszawa&t=ffab&ia=weather")
     elif arg == "oświęcimiu":
         webbrowser.open_new_tab(
             "https://www.weatheronline.pl/Malopolskie/Oswiecim.htm")
     elif arg == "oświęcim":
         webbrowser.open_new_tab(
             "https://www.weatheronline.pl/Malopolskie/Oswiecim.htm")
     elif arg == "jasień":
         webbrowser.open_new_tab(
             "https://www.weatheronline.pl/Pomorskie/Bytow.htm")
     elif arg == "jasieniu":
         webbrowser.open_new_tab(
             "https://www.weatheronline.pl/Pomorskie/Bytow.htm")
Ejemplo n.º 2
0
def kill_program(progname):
    try:
        print(progname)
        os.system("killall " + progname)
    except FileNotFoundError:
        speak("Nie znaleziono programu.")
        pass
Ejemplo n.º 3
0
 def launch():
     speak("Otwieram Twoje ulubione komiksy.")
     webbrowser.open_new_tab("https://leasticoulddo.com/")
     webbrowser.open_new_tab("https://www.lfg.co/")
     webbrowser.open_new_tab("http://www.tabletitans.com/")
     webbrowser.open_new_tab("http://www.konradokonski.com/KWD/")
     webbrowser.open_new_tab("http://www.totempole666.com/")
     webbrowser.open_new_tab("http://www.smbc-comics.com/index.php/")
Ejemplo n.º 4
0
def note_playback():
    speak("Którą notatkę mam odtworzyć?")
    with open("notelist.txt") as file:
        lines = [line.strip() for line in file]
    command = record_audio()
    if command in lines:
        os.system("aplay {}-{}.wav".format(datetime.date.today(), command))
    else:
        speak("Nie znaleziono notatki.")
Ejemplo n.º 5
0
def note_remove():
    with open("notelist.txt") as file:
        lines = [line.strip() for line in file]
    speak("Którą notatkę mam usunąć?")
    command = record_audio()
    if command in lines:
        f = open("notelist.txt", "r")
        filecontent = f.read()
        f.close()
        newcontent = filecontent.replace("{}\n".format(command), "")
        f = open("notelist.txt", "w")
        f.write(newcontent)
        f.close()
        os.remove("{}-{}.wav".format(datetime.date.today(), command))
    else:
        speak("Nie znaleziono notatki.")
Ejemplo n.º 6
0
def dictation():
    while True:
        output = (record_audio() + " ")
        if output == "przecinek ":
            output.replace("przecinek", ",")
            pyautogui.typewrite(output)
            continue
        elif output == "kropka ":
            output.replace("kropka", ".")
            pyautogui.typewrite(output)
            continue
        elif output == "enter ":
            output.replace("enter ", "\n")
            pyautogui.typewrite(output)
            continue
        elif "bez odbioru" in output:
            speak("okej")
            return
        else:
            for i in output:
                if i == 'ą':
                    pyautogui.hotkey('altright', 'a')
                elif i == "ć":
                    pyautogui.hotkey('altright', 'c')
                elif i == "ę":
                    pyautogui.hotkey('altright', 'e')
                elif i == "ł":
                    pyautogui.hotkey('altright', 'l')
                elif i == "ń":
                    pyautogui.hotkey('altright', 'n')
                elif i == "ó":
                    pyautogui.hotkey('altright', 'o')
                elif i == "ś":
                    pyautogui.hotkey('altright', 's')
                elif i == "ź":
                    pyautogui.hotkey('altright', 'x')
                elif i == "ż":
                    pyautogui.hotkey('altright', 'z')
                else:
                    print(i)
                    pyautogui.press(i)
Ejemplo n.º 7
0
def note_list():
    speak("Lista notatek:")
    with open("notelist.txt") as file:
        lines = [line.strip() for line in file]
    for i in lines:
        speak(i)
    speak("Czy chcesz otworzyć którąś notatkę?")
    command = record_audio()
    if "tak" in command:
        note_playback()
    elif command in lines:
        os.system("aplay {}-{}.wav".format(datetime.date.today(), command))
    elif "nie" in command:
        speak("Rozumiem")
    else:
        return
Ejemplo n.º 8
0
 def launch():
     speak("Czy uruchomić ponownie komputer?")
     command = record_audio()
     if "tak" in command:
         speak("OK.")
         os.system("shutdown -r now")
     else:
         speak("W porządku, anuluję operację.")
         return
Ejemplo n.º 9
0
 def launch():
     speak("Czy na pewno wyłączyć komputer?")
     command = record_audio()
     if "tak" in command:
         speak("Wyłączam komputer.")
         os.system("shutdown -h now")
     else:
         speak("W porządku, anuluję operację.")
         return
Ejemplo n.º 10
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from commandPrompt import command_prompt
from audioFunctions import speak
import speech_recognition as sr
import time

mode = 'voice'


speak("Rozpoznawanie")
time.sleep(1.5)
r = sr.Recognizer()
while True:
    try:
        print("Nasłuchuję słowa kluczowego...")
        if mode == "voice":
            with sr.Microphone() as source:
                r.adjust_for_ambient_noise(source, duration=1)
                audio = r.listen(source)
            phrase = r.recognize_sphinx(audio)
        else:
            phrase = input()
        print("Sphinx rozpoznał wypowiedź: \n" + phrase)
        if "hello" in phrase:
            speak("W czym mogę pomóc?")
            command_prompt(mode)
        elif "check" in phrase:
            speak("Działam.")
        elif "finish" in phrase:
            speak("Do usłyszenia!")
Ejemplo n.º 11
0
from functions import dictation
from audioFunctions import speak

speak("Możesz zaczynać.")
dictation()
Ejemplo n.º 12
0
 def launch():
     speak("Podaj temat.")
     subject = record_audio()
     print(subject)
     speak("Podaj odbiorcę")
     recipient = record_audio()
     print(recipient)
     try:
         with open("recipients.txt") as f:
             emailContacts = dict(line.strip().split(":") for line in f)
     except FileNotFoundError:
         print("Lista odbiorców niedostępna.")
         emailContacts = {}
     if recipient in emailContacts:
         recipientAddress = emailContacts[recipient]
         print(recipientAddress)
         speak("Podaj treść")
         mailBody = record_audio()
         print(mailBody)
         speak("Przygotowano wiadomość do odbiorcy: " + recipient +
               " o temacie: " + subject + " i treści: " + mailBody +
               ". Czy otworzyć w programie pocztowym?")
         decision = record_audio()
         if decision == "tak":
             polecenie = "xdg-email --subject \'{!s}\' --body \'{!s}\' \'{!s}\'".format(
                 subject, mailBody, recipientAddress)
             subprocess.Popen(shlex.split(polecenie))
         else:
             speak("Kasuję wiadomość.")
     else:
         speak("Nie rozpoznano odbiorcy")
Ejemplo n.º 13
0
 def launch():
     speak("Do usług.")
     programFunctions.run_program("google-chrome")
     programFunctions.run_program("synology-note-station")
     programFunctions.run_program("geary")
     programFunctions.run_program("firefox")
Ejemplo n.º 14
0
 def launch():
     speak("Do usług.")
     programFunctions.run_program("gnome-terminal")
     programFunctions.run_program("synology-note-station")
     programFunctions.run_program("firefox")
     subprocess.Popen(shlex.split("flatpak run io.atom.Atom"))
Ejemplo n.º 15
0
 def launch():
     speak("Otwieram Amazon Prajm")
     webbrowser.open_new_tab("https://www.primevideo.com/")
Ejemplo n.º 16
0
 def launch():
     speak("Otwieram tłumacza Google.")
     webbrowser.open_new_tab("https://translate.google.pl/")
Ejemplo n.º 17
0
def command_prompt(parameter):
    while True:
        if parameter == 'voice':
            command = record_audio()
        elif parameter == 'text':
            command = input()
        else:
            command = record_audio()
        if all(word not in command for word in (dictionary.quits + dictionary.plays + dictionary.pauses + dictionary.nexts)):
            if command in dictionary.lexicon:
                word = dictionary.lexicon[command]
                word.launch()
            elif programOn(command):
                elements = command.split(" ")
                for word in elements:
                    if word in dictionary.lexicon:
                        word = dictionary.lexicon[word]
                        word.launch()
            elif "gdzie" in command:
                command = command.split(" ", 2)
                location = command[2]
                speak("Pokazuję " + location)
                webbrowser.open_new_tab("https://www.google.com/maps/place/" + location + "/&")
            elif "co umiesz" in command:
                speak("Pokazuję listę funkcji")
                webbrowser.open_new_tab("https://github.com/ldziubek/alfred/blob/master/README.md")
            elif any(word in command for word in dictionary.search):
                command = command.split(" ", 1)
                keyword = command[1]
                speak("Wyszukuję " + keyword)
                webbrowser.open_new_tab("https://duckduckgo.com/?q=" + keyword)
            elif weatherInCity(command):
                elements = command.split(" ")
                for word in elements:
                    if word in dictionary.cities:
                        projectClasses.WeatherForecast.launchCity(word)
            elif weather(command):
                projectClasses.WeatherForecast.launch()
            if "to wszystko" in command:
                speak("Dziękuję. Bez odbioru.")
                return
            if "błąd rozpoznawania" in command:
                speak("Błąd. Bez odbioru.")
                return
        else:
            if programOff(command):
                elements = command.split(" ")
                for word in elements:
                    if word in dictionary.lexicon:
                        word = dictionary.lexicon[word]
                        word.kill()
            elif play(command):
                elements = command.split(" ")
                for word in elements:
                    if word in dictionary.lexicon:
                        word = dictionary.lexicon[word]
                        word.play()
            elif pause(command):
                elements = command.split(" ")
                for word in elements:
                    if word in dictionary.lexicon:
                        word = dictionary.lexicon[word]
                        word.pause()
            elif nextSong(command):
                elements = command.split(" ")
                for word in elements:
                    if word in dictionary.lexicon:
                        word = dictionary.lexicon[word]
                        word.next()
Ejemplo n.º 18
0
 def launch():
     speak("Otwieram DeepL.")
     webbrowser.open_new_tab("https://www.deepl.com/translator")
Ejemplo n.º 19
0
 def launch():
     speak("Otwieram stronę banku.")
     webbrowser.open_new_tab("https://www.pekao24.pl/")
Ejemplo n.º 20
0
 def launch():
     speak("Otwieram prognozę pogody.")
     webbrowser.open_new_tab(
         "https://duckduckgo.com/?q=weather+krak%C3%B3w&t=ffab&ia=weather")
Ejemplo n.º 21
0
 def launch():
     speak("Otwieram Netfliksa.")
     webbrowser.open_new_tab("http://www.netflix.com/browse")
Ejemplo n.º 22
0
def note_add():
    speak("Słucham!")
    note_recorder()
    speak("Czy zapisać?")
    command = record_audio()
    if "tak" in command:
        speak("Podaj nazwę")
        name = record_audio()
        listfile = "notelist.txt"
        with open(listfile, 'a') as f:
            f.write(name + "\n")
        os.rename("note.wav", "{}-{}.wav".format(datetime.date.today(), name))
        speak("Zapisano notatkę: {}".format(name))
    elif "odtwórz" in command:
        os.system("aplay note.wav")
        speak("Czy zapisać?")
        command = record_audio()
        if "tak" in command:
            speak("Podaj nazwę")
            name = record_audio()
            listfile = "notelist.txt"
            with open(listfile, 'a') as f:
                f.write(name + "\n")
            os.rename("note.wav", "{}-{}.wav".format(datetime.date.today(), name))
            speak("Zapisano notatkę: {}".format(name))
        elif "nie" in command:
            os.remove("note.wav")
            speak("Notatka nie została zapisana")
    elif "nie" in command:
        os.remove("note.wav")
        speak("Notatka nie została zapisana")
    else:
        return
Ejemplo n.º 23
0
 def launch():
     speak("Otwieram słownik.")
     webbrowser.open_new_tab("http://www.ling.pl/")
Ejemplo n.º 24
0
 def launch():
     speak("Do usług.")
     programFunctions.run_program("soffice")
     programFunctions.run_program("geary")
     programFunctions.run_program("gnome-calculator")
Ejemplo n.º 25
0
 def launch():
     speak("Włączam lajbry")
     subprocess.Popen(shlex.split("flatpak run io.lbry.lbry-app"))
Ejemplo n.º 26
0
 def launch():
     speak("Otwieram HBO GO.")
     webbrowser.open_new_tab("https://hbogo.pl/")
Ejemplo n.º 27
0
def run_program(progname):
    try:
        subprocess.Popen(progname)
    except FileNotFoundError:
        speak("Nie znaleziono programu.")
        pass
Ejemplo n.º 28
0
 def launch():
     speak(functions.reformat_time())
Ejemplo n.º 29
0
 def launch():
     speak("Możesz zaczynać")
     functions.dictation()
Ejemplo n.º 30
0
 def launch():
     speak("Otwieram platformę Quill.")
     webbrowser.open_new_tab("https://app.quill-cloud.com/")