Exemplo n.º 1
0
def setNewUser():
    usr_info_dic = {}
    clear.clear()
    voice_io.show("What shall I call you Master? ")
    nm = bytes(
        invoice.inpt(), encoding="utf-8"
    )  #Name of the user i.e the name by which the assistant will call him/her
    voice_io.show(
        "\nAnd you are, Master or Miss, master? ")  #Gender of the user
    gnd = invoice.inpt()
    asst_pswd = bytes(getpass.getpass(
        voice_io.show("\nWhat should be your password for accessing me?",
                      show_output=False) + "\nPassword: "******"utf-8")
    salt = b'$2b$12$3hbla5Xs2Ekx9SGVYfWQuO'
    hashed_pswd = bcrypt.hashpw(asst_pswd, salt)
    kdf = PBKDF2HMAC(
        algorithm=hashes.SHA256(),
        length=32,
        salt=salt,
        iterations=100000,
    )
    global key
    key = base64.urlsafe_b64encode(kdf.derive(hashed_pswd))
    #with open(get_dirs.FILE_ENCRYPT_KEY,'wb+') as f:
    #    f.write(key)
    voice_io.show(
        "\nAnd now what would be your 'gmail' address? Note: Right now I support gmail (google) accounts only, so please make one if you don't have one already, to continue! "
    )
    eml = bytes(invoice.inpt(processed=False), encoding="utf-8")
    print(
        "\nLastly I need you to authenticate this with Daddy Google for me, you can skip this now but know that I will be needing this to perform Email Operations! Press: "
    )
    ch = input(
        "\n1. To authenticate it right now, like a good master! ^o^\n2. To skip and not be cool to me, like a bad master! U_U\n"
    )
    if ch == '1':
        gmail_authentication()
    elif ch == '2':
        pass
    else:
        print("Invalid Input, Skipping!")
    cipher_suite = Fernet(key)
    usr_info_dic['name'] = cipher_suite.encrypt(nm)
    GND_FEMALE = ["girl", 'miss', 'missus', 'mrs', 'female', 'lady', 'woman']
    GND_MALE = ["boy", "master", "mister", "mr", "male", "lodu", "man"]
    if gnd.lower() in GND_FEMALE:
        usr_info_dic['gender'] = cipher_suite.encrypt(b"Female")
    elif gnd.lower() in GND_MALE:
        usr_info_dic['gender'] = cipher_suite.encrypt(b"Male")
    else:
        usr_info_dic['gender'] = cipher_suite.encrypt(b"Others")
    usr_info_dic["asst_password"] = cipher_suite.encrypt(hashed_pswd)
    usr_info_dic['email'] = cipher_suite.encrypt(eml)
    info_in(usr_info_dic)
    voice_io.show(
        "Well then you're good to go! Just press Enter/Return to continue!",
        end="")
    invoice.inpt("", iterate=False)
    return key, nm.decode("utf-8")
Exemplo n.º 2
0
def deleteFolder(folder_name, search_dir):
    folder_search_results = folderSearch(folder_name, search_dir)
    if folder_search_results != []:
        if len(folder_search_results) == 1:
            invoice.inpt(
                "%s from %s will be permanently lost, press Enter to continue."
                % (folder_search_results[0]["folder"],
                   folder_search_results[0]["root"]),
                iterate=False)
            shutil.rmtree(folder_search_results[0]["root"] + "/" +
                          folder_search_results[0]["folder"])
            voice_io.show(folder_name, "has been deleted successfully!")

        else:
            n_results = len(folder_search_results)
            voice_io.show(
                f"Found {n_results} folder matching the given folder name! They are :-"
            )
            sno = 1
            for i in folder_search_results:
                voice_io.show(
                    f"{sno}. folder '{i['folder']}', inside '{i['root']}'")
                sno += 1
            voice_io.show(
                "Select the number of the folder which you would like to delete"
            )
            choice = int(invoice.inpt())
            choice -= 1
            try:
                f_name = folder_search_results[choice]['folder']
                parent_dir = folder_search_results[choice]['root']
                invoice.inpt(
                    f"'{f_name}' from '{parent_dir}' will be permanently lost, press Enter to continue.",
                    iterate=False)
                shutil.rmtree(parent_dir + "/" + f_name)
                voice_io.show(f"'{f_name}' has been deleted successfully!")

            except IndexError:
                voice_io.show(
                    "Deletion failed : Sorry, but the entered number is not within the range of available options."
                )

            except SyntaxError or TypeError:
                voice_io.show(
                    "Deletion failed : Sorry, but your entered data is not a number."
                )

    else:
        voice_io.show(
            f"Sorry, could not find file '{folder_name}', please check if the file you named exists or\nhas been spelled correctly."
        )
Exemplo n.º 3
0
def main():
    clear.clear()
    voice_io.show(
        "*NOTE: The news feature is still under-development and so it might be prone to errors. Please report any such occurences if you find one! Thanks @Prabhat.\n"
    )
    voice_io.show(
        "Here comes the news boy! Haha How can i help you today? Please Press: "
    )
    voice_io.show("1. For Today's top headlines.")
    voice_io.show("2. For Top headlines in a category.")
    voice_io.show("3. For Top headlines in another country.")
    voice_io.show("4. To Search for News.")
    voice_io.show("5. To go back.")
    ch = invoice.inpt("Here: ")
    if ch == '1':
        headlines()

    elif ch == '2':
        catg = invoice.inpt(
            "What Category trending news do you want to see? ['business', 'entertainment', 'general', 'health', 'science', 'sports', 'technology']: "
        )
        if catg not in [
                'business', 'entertainment', 'general', 'health', 'science',
                'sports', 'technology'
        ]:
            voice_io.show(
                "I'm not sure if i can do that! Anyway here's the general trending news!"
            )
            headlines()
        else:
            headlines(catg=catg)

    elif ch == '3':
        cnt = invoice.inpt(
            "Which Country's trending news do you want to see?: ")
        cnt_code = cnt_iso3166(cnt)
        headlines(cnt=cnt_code)

    elif ch == '4':
        search_news()

    elif ch == '5':
        return

    else:
        voice_io.show("Invalid Input!")
Exemplo n.º 4
0
def note_write():
    note_rem_create()
    con = sql.connect(get_dirs.DB_NOTES_REMINDERS)
    cur = con.cursor()
    voice_io.show("Okay so you wanna enter a new note? Here ya go!")
    x1 = invoice.inpt("Enter Note Here: ", processed=False)
    cur.execute(
        "insert into notes values(datetime('now', 'localtime'), '%s');" % x1)
    voice_io.show("Note Saved Successfully!")
    con.commit()
    con.close()
Exemplo n.º 5
0
def reminder_write():
    note_rem_create()
    con = sql.connect(get_dirs.DB_NOTES_REMINDERS)
    cur = con.cursor()
    x1 = invoice.inpt("Enter Reminder: ")
    x2 = invoice.inpt("Enter Date to be Notified (YYYY-MM-DD): ")
    x3 = input("Enter Time to be Notified (HH:MM:SS): ")
    x4 = x2 + ' ' + x3
    datetime_now = time_now()

    if x4 < datetime_now:
        prmpt = input(
            "Hey you are entering a reminder for a date and time that has already passed, are you sure you want to continue? "
        )
        prmpt = prmpt.lower()
        if prmpt in ['yeah', 'yep', 'yes', 'ok']:
            voice_io.show("Alright as you wish, master!")
            cur.execute(
                "insert into past_reminders values(datetime('now', 'localtime'), '%s', '%s');"
                % (x1, x4))
            voice_io.show("Reminder Saved Successfully!")
            con.commit()
        elif prmpt in ['no', 'nah', 'nope', 'not really']:
            voice_io.show("Okay!")
        else:
            voice_io.show("Invalid Input!")

    elif x4 > datetime_now:
        cur.execute(
            "insert into future_reminders values(datetime('now', 'localtime'), '%s', '%s');"
            % (x1, x4))
        voice_io.show("Reminder Saved Successfully!")
        con.commit()
        #reminder_remind()

    else:
        voice_io.show(
            "An internal error occurred while processing your request, please make sure you've entered the values correctly and try again!"
        )

    con.close()
Exemplo n.º 6
0
Arquivo: main.py Projeto: OkKori/Kori
def deleteFolderUnspecified():
    search_dir = ""
    voice_io.show("Which folder do you want to delete?")
    folder_name = invoice.inpt(processed=False)
    voice_io.show(
        f"Where would you like me to search for the folder, {folder_name}?\n1. Desktop\n2. Downloads\n3. Documents\n4. Music\n5. Pictures\n6. Videos\n7. Entire home directory"
    )
    locate = invoice.inpt().lower()
    if locate in locate_desktop:
        search_dir = desktop

    elif locate in locate_documents:
        search_dir = documents

    elif locate in locate_downloads:
        search_dir = downloads

    elif locate in locate_home:
        search_dir = home

    elif locate in locate_music:
        search_dir = music

    elif locate in locate_pictures:
        search_dir = pictures

    elif locate in locate_videos:
        search_dir = videos

    else:
        voice_io.show(
            "Sorry but i can not find the given directory, going forward with the entire home directory!"
        )
        search_dir = home

    file_op.deleteFolder(folder_name=folder_name, search_dir=search_dir)
Exemplo n.º 7
0
Arquivo: main.py Projeto: OkKori/Kori
def pda_help():
    voice_io.show(
        "Select from the following Settings which can i help you with?")
    voice_io.show("1. Assistant Settings Update")
    voice_io.show("2. Assitant Settings Reset")
    voice_io.show("3. User Data Update")
    x = invoice.inpt("Enter Choice: ")
    if x == "1":
        assistant_settings.ass_settings_update()
    elif x == "2":
        assistant_settings.ass_settings_reset()
    elif x == "3":
        usr_signup.info_update()
    else:
        voice_io.show(
            "Invalid Input! Please make sure you're entering a valid input!")
Exemplo n.º 8
0
Arquivo: main.py Projeto: OkKori/Kori
def userSetup():
    return_val = True
    voice_io.show("""Hello There!

I am Kori, your Personal Virtual Assistant.
I will be present at all times, waiting for your command.
You can ask me to do whatever you want! 
Want to get some work done and need help to ease your burden? 
or Check in on the latest news headlines and match scores 
or Wanna lighten up your mood with some funny jokes 
or Tune in to your favorite podcasts or songs, all of this and more 
without lifting a single finger? Well that's what I was made for :)

But first, please do let me know you better.
    
The voice output feature is turned off by default as I'm still in
my fetal phase and my voice box, so to speak, is not ready yet! ;)
But if you still want to use it, type 'enable sound' and ENDURE!!! 

By the way, I will be taking Text Input (as my ears too are... you know) 
but you can always use the command 'voice' if you would prefer to speak 
your commands instead.

Now then, Please Press Enter/Return to continue.
""")
    command = invoice.inpt(iterate=False)

    if command == "":
        pass
    else:
        voice_io.show(
            "Sorry I don't get it, I'm continuing with the Setup Process.")

    if not os.path.exists(get_dirs.PATH_USR_DATA):
        os.mkdir(get_dirs.PATH_USR_DATA)
    global key, usr_name
    key, usr_name = usr_signup.main(operation="new")
Exemplo n.º 9
0
def playMusic(name, search_dir):
    from playsound import playsound
    file_search_results = fileSearch(file_name=name, search_dir=search_dir)
    music_files = []
    if len(file_search_results) > 0:
        for file_obj in file_search_results:
            f_name = file_obj['file']
            for ext in audio_file_ext:
                if ext in f_name:
                    music_files.append(file_obj)
                    break

        if len(music_files) == 1:
            f_name = music_files[0]['file']
            directory = music_files[0]['root']
            f_path = directory + '/' + f_name
            voice_io.show(
                f"Playing the audio file '{f_name}' from '{directory}'.")
            p = multiprocessing.Process(target=playsound, args=(f_path, ))
            p.start()
            input("Press ENTER to stop playback")
            p.terminate()
            voice_io.show(f"Stopped playing '{f_name}'.")

        elif len(music_files) > 1:
            sno = 1
            voice_io.show(
                f"Found {len(music_files)} files matching the given file name :-"
            )
            for i in music_files:
                voice_io.show(
                    f"{sno}. file '{i['file']}', inside '{i['root']}'")
                sno += 1
            voice_io.show(
                "Select the number of the audio file which you would like to play."
            )
            choice = int(invoice.inpt())
            choice -= 1
            try:
                f_name = music_files[choice]['file']
                directory = music_files[choice]['root']
                f_path = directory + "/" + f_name
                voice_io.show(
                    f"Playing the audio file '{f_name}' from '{directory}'.")
                p = multiprocessing.Process(target=playsound, args=(f_path, ))
                p.start()
                input("Press ENTER to stop playback")
                p.terminate()
                voice_io.show(f"Stopped playing '{f_name}'.")
            except IndexError:
                voice_io.show(
                    "Playback failed : Sorry, but the entered number is not within the range of available options."
                )

            except SyntaxError or TypeError:
                voice_io.show(
                    "Playback failed : Sorry, but your entered data is not a number."
                )

        else:
            voice_io.show(
                f"Sorry, could not find any audio file with the name '{name}'")

    else:
        voice_io.show(
            f"Sorry, could not find any audio file with the name '{name}'")
Exemplo n.º 10
0
def file_opener(obj_name, search_dir):
    folder_search_results = folderSearch(obj_name, search_dir)
    file_search_results = fileSearch(obj_name, search_dir)
    if folder_search_results != [] and file_search_results != 0:
        count_files = len(file_search_results)
        count_folders = len(folder_search_results)
        voice_io.show(
            f"Found {count_files} files and {count_folders} folders matching the given name! They are :-"
        )
        sno = 1
        for i in file_search_results:
            voice_io.show(f"{sno}. file '{i['file']}', inside '{i['root']}'")
            sno += 1

        for i in folder_search_results:
            voice_io.show(
                f"{sno}. folder '{i['folder']}', inside '{i['root']}'")
            sno += 1
        voice_io.show(
            "Select the number of the file/folder which you would like to open."
        )
        choice = int(invoice.inpt())
        choice -= 1
        try:
            if choice in range(count_files):
                f_name = file_search_results[choice]['file']
                parent_dir = file_search_results[choice]['root']
                voice_io.show(
                    f"Opening file '{f_name}' from '{parent_dir}'.....")
                full_dir = parent_dir + "/" + f_name
                open_file(full_dir)

            elif choice - (count_files) in range(count_folders):
                choice -= count_files
                f_name = folder_search_results[choice]['folder']
                parent_dir = folder_search_results[choice]['root']
                voice_io.show(
                    f"Opening folder '{f_name}' from '{parent_dir}' in the Files Explorer....."
                )
                full_dir = parent_dir + "/" + f_name
                open_file(full_dir)

            else:
                voice_io.show(
                    "Opening failed : Sorry, but the entered number is not within the range of available options."
                )

        except SyntaxError or TypeError:
            voice_io.show(
                "Opening failed : Sorry, but your entered data is not a number."
            )

    elif folder_search_results != []:
        if len(folder_search_results) == 1:
            voice_io.show(
                f"Opening folder '{folder_search_results[0]['folder']}' from '{folder_search_results[0]['root']}' in the Files Explorer....."
            )
            open_file(folder_search_results[0]["root"] + "/" +
                      folder_search_results[0]["folder"])

        else:
            sno = 1
            for i in folder_search_results:
                voice_io.show(
                    f"{sno}. folder '{i['folder']}', inside '{i['root']}'")
                sno += 1
            voice_io.show(
                "Select the number of the folder which you would like to open."
            )
            choice = int(invoice.inpt())
            choice -= 1
            try:
                f_name = folder_search_results[choice]['folder']
                parent_dir = folder_search_results[choice]['root']
                voice_io.show(
                    f"Opening folder '{f_name}' from '{parent_dir}' in the Files Explorer....."
                )
                full_dir = parent_dir + "/" + f_name
                open_file(full_dir)

            except IndexError:
                voice_io.show(
                    "Opening failed : Sorry, but the entered number is not within the range of available options."
                )

            except SyntaxError or TypeError:
                voice_io.show(
                    "Opening failed : Sorry, but your entered data is not a number."
                )

    elif file_search_results != []:
        if len(file_search_results) == 1:
            voice_io.show(
                f"Opening file '{file_search_results[0]['file']}' from '{file_search_results[0]['root']}'....."
            )
            open_file(file_search_results[0]["root"] + "/" +
                      file_search_results[0]["file"])

        else:
            sno = 1
            for i in file_search_results:
                voice_io.show(
                    f"{sno}. file '{i['file']}', inside '{i['root']}'")
                sno += 1
            voice_io.show(
                "Select the number of the file which you would like to open.")
            choice = int(invoice.inpt())
            choice -= 1
            try:
                f_name = file_search_results[choice]['file']
                parent_dir = file_search_results[choice]['root']
                voice_io.show(
                    f"Opening file '{f_name}' from '{parent_dir}'.....")
                full_dir = parent_dir + "/" + f_name
                open_file(full_dir)

            except IndexError:
                voice_io.show(
                    "Opening failed : Sorry, but the entered number is not within the range of available options."
                )

            except SyntaxError or TypeError:
                voice_io.show(
                    "Opening failed : Sorry, but your entered data is not a number."
                )

    else:
        voice_io.show(f"Sorry, could not find file/folder '{obj_name}'!")
Exemplo n.º 11
0
def rname(obj_name, new_name, search_dir):
    folder_search_results = folderSearch(obj_name, search_dir)
    file_search_results = fileSearch(obj_name, search_dir)
    new_file_name = ""
    new_ext = ""
    old_file_name = ""
    old_ext = ""

    if folder_search_results != [] and file_search_results != []:
        count_files = len(file_search_results)
        count_folders = len(folder_search_results)
        voice_io.show(
            f"Found {count_files} files and {count_folders} folders matching the given name! They are :-"
        )
        sno = 1
        for i in file_search_results:
            voice_io.show(f"{sno}. file '{i['file']}', inside '{i['root']}'")
            sno += 1

        for i in folder_search_results:
            voice_io.show(
                f"{sno}. folder '{i['folder']}', inside '{i['root']}'")
            sno += 1
        voice_io.show(
            "Select the number of the file/folder which you would like to rename."
        )
        choice = int(invoice.inpt())
        choice -= 1
        try:
            if choice in range(count_files):
                f_name = file_search_results[choice]['file']
                new_name = new_name.split('.')
                new_file_name = new_name[0]
                if len(new_name) > 2:
                    for i in range(1, len(new_name) - 2):
                        new_file_name += "." + new_name[i]

                if len(new_name) > 1:
                    new_ext = new_name[len(new_name) - 1]
                    if new_ext == new_file_name:
                        new_ext = ""

                if len(f_name.split(".")) > 1:
                    old_ext = f_name.split(".")[len(f_name.split(".")) - 1]
                    if new_ext == "" and old_ext != f_name.split('.')[0]:
                        new_ext = old_ext

                new_full_name = new_file_name + "." + new_ext

                parent_dir = file_search_results[choice]['root']
                voice_io.show(
                    f"Renaming file '{f_name}' from '{parent_dir}' to '{new_full_name}'....."
                )
                os.rename(parent_dir + "/" + f_name,
                          parent_dir + "/" + new_full_name)
                voice_io.show(
                    f"Successfully renamed '{f_name}' to '{new_full_name}'!")

            elif choice - (count_files) in range(count_folders):
                choice -= (count_files)
                f_name = folder_search_results[choice]['folder']
                parent_dir = folder_search_results[choice]['root']
                voice_io.show(
                    f"Renaming folder '{f_name}' from '{parent_dir}' to '{new_name}''....."
                )
                os.rename(parent_dir + "/" + f_name,
                          parent_dir + "/" + new_name)
                voice_io.show(
                    f"Successfully renamed '{f_name}' to '{new_name}'!")

            else:
                voice_io.show(
                    "Renaming failed : Sorry, but the entered number is not within the range of available options."
                )

        except SyntaxError or TypeError:
            voice_io.show(
                "Renaming failed : Sorry, but your entered data is not a number."
            )

    elif folder_search_results != []:
        if len(folder_search_results) == 1:
            parent_dir = folder_search_results[0]["root"]
            f_name = folder_search_results[0]["folder"]
            voice_io.show(
                f"Renaming folder '{folder_search_results[0]['folder']}' from '{folder_search_results[0]['root']}' to '{new_name}'....."
            )
            os.rename(parent_dir + "/" + f_name, parent_dir + "/" + new_name)
            voice_io.show(
                f"Successfully renamed '{folder_search_results[0]['folder']}' to '{new_name}'!"
            )

        else:
            sno = 1
            for i in folder_search_results:
                voice_io.show(
                    f"{sno}. folder '{i['folder']}', inside '{i['root']}'")
                sno += 1
            voice_io.show(
                "Select the number of the folder which you would like to rename."
            )
            choice = int(invoice.inpt())
            choice -= 1
            try:
                f_name = folder_search_results[choice]['folder']
                parent_dir = folder_search_results[choice]['root']
                voice_io.show(
                    f"Renaming folder '{f_name}' from '{parent_dir}' to '{new_name}'....."
                )
                os.rename(parent_dir + "/" + f_name,
                          parent_dir + "/" + new_name)
                voice_io.show(
                    f"Successfully renamed '{f_name}' to '{new_name}'!")

            except IndexError:
                voice_io.show(
                    "Renaming failed : Sorry, but the entered number is not within the range of available options."
                )

            except SyntaxError or TypeError:
                voice_io.show(
                    "Renaming failed : Sorry, but your entered data is not a number."
                )

    elif file_search_results != []:
        if len(file_search_results) == 1:
            parent_dir = file_search_results[0]["root"]
            f_name = file_search_results[0]["file"]
            new_name = new_name.split('.')
            new_file_name = new_name[0]
            if len(new_name) > 2:
                for i in range(1, len(new_name) - 2):
                    new_file_name += "." + new_name[i]

            if len(new_name) > 1:
                new_ext = new_name[len(new_name) - 1]
                if new_ext == new_file_name:
                    new_ext = ""

            if len(f_name.split(".")) > 1:
                old_ext = f_name.split(".")[len(f_name.split(".")) - 1]
                if new_ext == "" and old_ext != f_name.split('.')[0]:
                    new_ext = old_ext

            new_full_name = new_file_name + "." + new_ext

            voice_io.show(
                f"Renaming file '{file_search_results[0]['file']}' from '{file_search_results[0]['root']}' to '{new_full_name}''....."
            )
            os.rename(parent_dir + "/" + f_name,
                      parent_dir + "/" + new_full_name)
            voice_io.show(
                f"Successfully renamed '{file_search_results[0]['file']}' to '{new_full_name}'!"
            )

        else:
            sno = 1
            for i in file_search_results:
                voice_io.show(
                    f"{sno}. file '{i['file']}', inside '{i['root']}'")
                sno += 1
            voice_io.show(
                "Select the number of the file which you would like to rename."
            )
            choice = int(invoice.inpt())
            choice -= 1
            try:
                f_name = file_search_results[choice]['file']
                new_name = new_name.split('.')
                new_file_name = new_name[0]
                if len(new_name) > 2:
                    for i in range(1, len(new_name) - 2):
                        new_file_name += "." + new_name[i]

                if len(new_name) > 1:
                    new_ext = new_name[len(new_name) - 1]
                    if new_ext == new_file_name:
                        new_ext = ""

                if len(f_name.split(".")) > 1:
                    old_ext = f_name.split(".")[len(f_name.split(".")) - 1]
                    if new_ext == "" and old_ext != f_name.split('.')[0]:
                        new_ext = old_ext

                new_full_name = new_file_name + "." + new_ext

                parent_dir = file_search_results[choice]['root']
                voice_io.show(
                    f"Renaming file '{f_name}' from '{parent_dir}' to '{new_full_name}'....."
                )
                os.rename(parent_dir + "/" + f_name,
                          parent_dir + "/" + new_full_name)
                voice_io.show(
                    f"Successfully renamed '{f_name}' to '{new_full_name}'!")

            except IndexError:
                voice_io.show(
                    "Renaming failed : Sorry, but the entered number is not within the range of available options."
                )

            except SyntaxError or TypeError:
                voice_io.show(
                    "Renaming failed : Sorry, but your entered data is not a number."
                )

    else:
        voice_io.show("Sorry, could not find file/folder '{obj_name}'!")
Exemplo n.º 12
0
def move(obj_name, search_dir, dest_dir):
    dest_dir = get_dirs.HOME + "/" + dest_dir
    if not os.path.isdir(dest_dir):
        os.mkdir(dest_dir)

    folder_search_results = folderSearch(obj_name, search_dir)
    file_search_results = fileSearch(obj_name, search_dir)
    if folder_search_results != [] and file_search_results != 0:
        count_files = len(file_search_results)
        count_folders = len(folder_search_results)
        voice_io.show(
            f"Found {count_files} files and {count_folders} folders matching the given name! They are :-"
        )
        sno = 1
        for i in file_search_results:
            voice_io.show(f"{sno}. file '{i['file']}', inside '{i['root']}'")
            sno += 1

        for i in folder_search_results:
            voice_io.show(
                f"{sno}. folder '{i['folder']}', inside '{i['root']}'")
            sno += 1
        voice_io.show(
            "Select the number of the file/folder which you would like to move."
        )
        choice = int(invoice.inpt())
        choice -= 1
        try:
            if choice in range(count_files):
                f_name = file_search_results[choice]['file']
                parent_dir = file_search_results[choice]['root']
                voice_io.show(
                    f"Moving file '{f_name}' from '{parent_dir}' to '{dest_dir}'....."
                )
                shutil.copy2(parent_dir + "/" + f_name, dest_dir)
                os.remove(parent_dir + "/" + f_name)
                voice_io.show(
                    f"Successfully moved '{f_name}' to '{dest_dir}'!")

            elif choice - (count_files) in range(count_folders):
                choice -= (count_files)
                f_name = folder_search_results[choice]['folder']
                parent_dir = folder_search_results[choice]['root']
                voice_io.show(
                    f"Moving folder '{f_name}' from '{parent_dir}' to '{dest_dir}'....."
                )
                copytree(parent_dir + "/" + f_name, dest_dir)
                shutil.rmtree(parent_dir + "/" + f_name)
                voice_io.show(
                    f"Successfully moved '{f_name}' to '{dest_dir}'!")

            else:
                voice_io.show(
                    "Moving failed : Sorry, but the entered number is not within the range of available options."
                )

        except SyntaxError or TypeError:
            voice_io.show(
                "Moving failed : Sorry, but your entered data is not a number."
            )

    elif folder_search_results != []:
        if len(folder_search_results) == 1:
            voice_io.show(
                f"Moving folder '{folder_search_results[0]['folder']}' from '{folder_search_results[0]['root']}' to '{dest_dir}'....."
            )
            copytree(
                folder_search_results[0]["root"] + "/" +
                folder_search_results[0]["folder"], dest_dir)
            shutil.rmtree(folder_search_results[0]["root"] + "/" +
                          folder_search_results[0]["folder"])
            voice_io.show(
                f"Successfully moved '{folder_search_results[0]['file']}' to '{dest_dir}'!"
            )

        else:
            sno = 1
            for i in folder_search_results:
                voice_io.show(
                    f"{sno}. folder '{i['folder']}', inside '{i['root']}'")
                sno += 1
            voice_io.show(
                "Select the number of the folder which you would like to move."
            )
            choice = int(invoice.inpt())
            choice -= 1
            try:
                f_name = folder_search_results[choice]['folder']
                parent_dir = folder_search_results[choice]['root']
                voice_io.show(
                    f"Moving folder '{f_name}' from '{parent_dir}' to '{dest_dir}'....."
                )
                copytree(parent_dir + "/" + f_name, dest_dir)
                shutil.rmtree(parent_dir + "/" + f_name)
                voice_io.show(
                    f"Successfully moved '{f_name}' to '{dest_dir}'!")

            except IndexError:
                voice_io.show(
                    "Moving failed : Sorry, but the entered number is not within the range of available options."
                )

            except SyntaxError or TypeError:
                voice_io.show(
                    "Moving failed : Sorry, but your entered data is not a number."
                )

    elif file_search_results != []:
        if len(file_search_results) == 1:
            voice_io.show(
                f"Moving file '{file_search_results[0]['file']}' from '{file_search_results[0]['root']}' to '{dest_dir}''....."
            )
            shutil.copy2(
                file_search_results[0]["root"] + "/" +
                file_search_results[0]["file"], dest_dir)
            os.remove(file_search_results[0]["root"] + "/" +
                      file_search_results[0]["file"])
            voice_io.show(
                f"Successfully moved '{file_search_results[0]['file']}' to '{dest_dir}'!"
            )

        else:
            sno = 1
            for i in file_search_results:
                voice_io.show(
                    f"{sno}. file '{i['file']}', inside '{i['root']}'")
                sno += 1
            voice_io.show(
                "Select the number of the file which you would like to copy.")
            choice = int(invoice.inpt())
            choice -= 1
            try:
                f_name = file_search_results[choice]['file']
                parent_dir = file_search_results[choice]['root']
                voice_io.show(
                    f"Moving file '{f_name}' from '{parent_dir}' to '{dest_dir}'....."
                )
                shutil.copy2(parent_dir + "/" + f_name, dest_dir)
                os.remove(parent_dir + "/" + f_name)
                voice_io.show(
                    f"Successfully moved '{f_name}' to '{dest_dir}'!")

            except IndexError:
                voice_io.show(
                    "Moving failed : Sorry, but the entered number is not within the range of available options."
                )

            except SyntaxError or TypeError:
                voice_io.show(
                    "Moving failed : Sorry, but your entered data is not a number."
                )

    else:
        voice_io.show(f"Sorry, could not find file/folder '{obj_name}'!")
Exemplo n.º 13
0
def headlines(cnt=cnt_code, catg='general'):
    url = ('https://newsapi.org/v2/top-headlines?'
           f'country={cnt}&'
           f'category={catg}&'
           f'apiKey={api}')
    #voice_io.show(url)
    response = requests.get(url)
    r = response.json()
    try:
        items = []
        for i in r['articles']:
            item = (i['title'], i['description'], i['url'])
            items.append(item)

        if len(items) == 0:
            voice_io.show(
                "Sorry I couldn't find anything like that! Maybe you didn't specify it properly or maybe there just isn't anything regarding that right now, so try again later, maybe!?"
            )

        else:
            for i in range(len(items)):
                clear.clear()
                voice_io.show(f'[{i+1}]', items[i][0])
                time.sleep(1)
                voice_io.show(
                    "\nWhat would you like to do? \n1. Expand this headline and read a little more about it. \n2. Open this news piece in your browser. \n3. Skip to the next headline. \n4. Print all news headlines at once. \n5. Go back."
                )
                ch = invoice.inpt("Enter Choice: ")
                if ch == '1':
                    voice_io.show(items[i][1])
                    time.sleep(3)
                    ch1 = invoice.inpt(
                        "\nWould you like to know about this some more? I could open this up in your browser! (Y/N): "
                    )
                    if ch1.lower() == 'y':
                        voice_io.show("Here you go!\n")
                        webbrowser.open(items[i][2])
                    elif ch1.lower() == 'n':
                        voice_io.show("Okay! Onto the next one! \n")
                    else:
                        voice_io.show("Invalid Input!")

                elif ch == '2':
                    voice_io.show("Here you go!")
                    webbrowser.open(items[i][2])
                    invoice.inpt("Press Enter to continue to the next story!")
                    continue

                elif ch == '3':
                    continue

                elif ch == '4':
                    while True:
                        clear.clear()
                        voice_io.show("Here you go!\n")
                        for j in range(len(items)):
                            voice_io.show(f'[{j+1}]', items[j][0])
                        time.sleep(3)
                        voice_io.show(
                            "\nWhat would you like to do now? \n1. Expand a specific headline and read a little more about it. \n2. Open a specific headline in your browser. \n3. Go back."
                        )
                        ch2 = invoice.inpt("Enter Choice: ")
                        if ch2 == '1':
                            inp = int(
                                invoice.inpt(
                                    "Enter the index of the news headline you'd like to know more about: "
                                ))
                            voice_io.show(items[inp - 1][0])
                            time.sleep(3)
                            ch3 = invoice.inpt(
                                "\nWould you like to know about this some more? I could open this up in your browser! (Y/N): "
                            )
                            if ch3.lower() == 'y':
                                #voice_io.show("Here you go!\n")
                                webbrowser.open(items[inp - 1][2])
                                continue
                            elif ch3.lower() == 'n':
                                ch3 = invoice.inpt(
                                    "\nDo you want to go back and read more news? (Y/N): "
                                )
                                if ch3.lower() == 'y':
                                    continue
                                else:
                                    return
                            else:
                                voice_io.show("Invalid Input!")
                            time.sleep(5)

                        elif ch2 == '2':
                            inp = int(
                                invoice.inpt(
                                    "Enter the index of the news headline you'd like to open up in your browser: "
                                ))
                            voice_io.show("Here you go!")
                            webbrowser.open(items[inp - 1][2])
                            ch3 = invoice.inpt(
                                "\nDo you want to go back and read more news? (Y/N): "
                            )
                            if ch3.lower() == 'y':
                                continue
                            else:
                                return

                        elif ch2 == '3':
                            return

                        else:
                            voice_io.show("Invalid Input!")

                elif ch == '5':
                    return

                else:
                    voice_io.show('Invalid Input!')

    except KeyError:
        voice_io.show(
            "Uh-oh! Looks like i ran into some error doing that! You sure everything's alright? Why not try again later!?"
        )
Exemplo n.º 14
0
def search_news():
    clear.clear()
    voice_io.show(
        "\nFor advanced news search please fill in the following (Note - Those fields with an asterisk before their names are optional and so are those with a default something specified, please leave them empty if you don't intend to use them!)"
    )
    qry = invoice.inpt(
        """\nKeywords or phrases to search for in the news articles (Note - Surround phrases with quotes ('/\") for exact matches, 
Prepend words or phrases that must appear with a + symbol. Eg: +bitcoin, Prepend words that must not appear with a - symbol. Eg: -bitcoin. 
Alternatively you can use the AND / OR / NOT keywords, and optionally group these with parenthesis. Eg: crypto AND (ethereum OR litecoin) NOT bitcoin.): """
    )
    params = {'q': qry}
    sort = input(
        "Sort By ['relevancy', 'popularity', 'publishedAt'] (default is 'publishedAt', it is for the newest articles first): "
    )
    sort = sort.lower()
    if sort not in ['relevancy', 'popularity', 'publishedAt']:
        sort = 'publishedAt'
    params['sortBy'] = sort
    catg = input(
        "Category of the news articles ['business', 'entertainment', 'general', 'health', 'science', 'sports', 'technology'] (default is 'general'): "
    )
    catg = catg.lower()
    if catg not in [
            'business', 'entertainment', 'general', 'health', 'science',
            'sports', 'technology'
    ]:
        catg = 'general'
    params['category'] = catg
    cnt = input(
        "Country you want the articles to be about (default is your set location): "
    )
    if cnt == '':
        cnt = cnt_code
        params['country'] = cnt
    else:
        cnt = cnt_iso3166(cnt)
        params['country'] = cnt
    incldom = input(
        "*Include Domains (A comma-seperated string of domains (eg bbc.co.uk, techcrunch.com, engadget.com) to restrict the search to): "
    )
    if incldom != '':
        params['domains'] = incldom
    excldom = input(
        "*Exclude Domains (A comma-seperated string of domains (eg bbc.co.uk, techcrunch.com, engadget.com) to remove from the results.): "
    )
    if excldom != '':
        params['excludeDomains'] = excldom
    frm = input(
        "*Date and optional time for the oldest article (e.g. 2021-09-02 or 2021-09-02T03:29:09): "
    )
    if frm != '':
        params['from'] = frm
    to = input(
        "*Date and optional time for the newest article (e.g. 2021-09-02 or 2021-09-02T03:29:09): "
    )
    if to != '':
        params['to'] = to

    url = 'https://newsapi.org/v2/top-headlines?'
    for i in params.keys():
        s = f'{i}={params[i]}&'
        url += s
    url += f"apiKey={api}"
    voice_io.show(url)
    response = requests.get(url)
    r = response.json()

    try:
        items = []
        for i in r['articles']:
            item = (i['title'], i['description'], i['url'])
            items.append(item)

        if len(items) == 0:
            voice_io.show(
                "Sorry I couldn't find anything like that! Maybe you didn't specify it properly or maybe there just isn't anything regarding that right now, so try again later, maybe!?"
            )

        else:
            for i in range(len(items)):
                clear.clear()
                voice_io.show(f'[{i+1}]', items[i][0])
                time.sleep(1)
                voice_io.show(
                    "\nWhat would you like to do? \n1. Expand this headline and read a little more about it. \n2. Open this news piece in your browser. \n3. Skip to the next headline. \n4. Print all news headlines at once. \n5. Go back."
                )
                ch = invoice.inpt("Enter Choice: ")
                if ch == '1':
                    voice_io.show(items[i][1])
                    time.sleep(3)
                    ch1 = invoice.inpt(
                        "\nWould you like to know about this some more? I could open this up in your browser! (Y/N): "
                    )
                    if ch1.lower() == 'y':
                        voice_io.show("Here you go!\n")
                        webbrowser.open(items[i][2])
                    elif ch1.lower() == 'n':
                        voice_io.show("Okay! Onto the next one! \n")
                    else:
                        voice_io.show("Invalid Input!")

                elif ch == '2':
                    voice_io.show("Here you go!")
                    webbrowser.open(items[i][2])
                    invoice.inpt("Press Enter to continue to the next story!")
                    continue

                elif ch == '3':
                    continue

                elif ch == '4':
                    while True:
                        voice_io.show("Here you go!\n")
                        for j in range(len(items)):
                            voice_io.show(f'[{j+1}]', items[j][0])
                        time.sleep(3)
                        voice_io.show(
                            "\nWhat would you like to do now? \n1. Expand a specific headline and read a little more about it. \n2. Open a specific headline in your browser. \n3. Go back."
                        )
                        ch2 = invoice.inpt("Enter Choice: ")
                        if ch2 == '1':
                            inp = int(
                                invoice.inpt(
                                    "Enter the index of the news headline you'd like to know more about: "
                                ))
                            voice_io.show(items[inp - 1][0])
                            time.sleep(3)
                            ch3 = invoice.inpt(
                                "Would you like to know about this some more? I could open this up in your browser! (Y/N): "
                            )
                            if ch3.lower() == 'y':
                                #voice_io.show("Here you go!\n")
                                webbrowser.open(items[inp - 1][2])
                                invoice.inpt(
                                    "Press Enter to continue to the next story!"
                                )
                                continue
                            elif ch3.lower() == 'n':
                                ch3 = invoice.inpt(
                                    "\nDo you want to go back and read more news? (Y/N): "
                                )
                                if ch3.lower() == 'y':
                                    continue
                                else:
                                    return
                            else:
                                voice_io.show("Invalid Input!")
                            time.sleep(5)

                        elif ch2 == '2':
                            inp = int(
                                invoice.inpt(
                                    "Enter the index of the news headline you'd like to open up in your browser: "
                                ))
                            voice_io.show("Here you go!")
                            webbrowser.open(items[inp - 1][2])
                            ch3 = invoice.inpt(
                                "\nDo you want to go back and read more news? (Y/N): "
                            )
                            if ch3.lower() == 'y':
                                continue
                            else:
                                return

                        elif ch2 == '3':
                            return

                        else:
                            voice_io.show("Invalid Input!")

                elif ch == '5':
                    return

                else:
                    voice_io.show('Invalid Input!')

    except KeyError:
        voice_io.show(
            "Uh-oh! Looks like i ran into some error doing that! You sure everything's alright? Why not try again later!?"
        )
Exemplo n.º 15
0
Arquivo: main.py Projeto: OkKori/Kori
def op_help():
    voice_io.show(
        "Alright, So What operations do you need help with? (just enter the operation, for example 'news', and i'll tell you its general syntax and what it does too.)"
    )
    x = invoice.inpt()
    x = x.lower()
    if "news" in x:
        voice_io.show(
            "With the News operation you can ask me to read out the top 20 news headlines from around the world and on any topic too. And if you're not satisfied with that, i can even look up specific news for you with my advanced news search feature."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show(
            "\"Kori tell me today's top news\" OR \"Hey read out today's top headlines\" (YOU GET THE IDEA)"
        )
        return
    elif "website" in x:
        voice_io.show(
            "With the website operation you can ask me to open certain websites in your default browser."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show(
            "\"Kori Open Youtube\" (BASIC WEBSITE OPENING) OR \"Open Instagram Kori\" (BASIC WEBSITE OPENING) OR \"Hey What is slavery?\" (WIKIPEDIA) OR  \"Define 'nuance'\" (GOOGLE SEARCH)"
        )
        return
    elif "email" in x:
        voice_io.show(
            "With this operation you can ask me to send an email to a contact of yours. Note: for this to function properly you must enter your email and password at the time of Sign Up. If you haven't correctly or want to change the same, use help."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show(
            "\"Kori help me send an email\" OR \"Hey i need you to send an email\" (OR ANY OTHER SORT OF EMAIL QUERY)"
        )
        return
    elif "song" in x:
        voice_io.show(
            "With the website operation you can ask me to play both online and offline songs. Note: for offline songs, make sure that there are songs in the root Music Directory of your PC and in case of online songs, the song won't play automatically but instead you'll see a youtube page opened up with your song searched and you'll have to click on the first result yourself. SORRY FOR THE INCONVINIENCE, THIS WILL MOST LIKELY BE RECTIFIED IN THE COMING UPDATES. :D"
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show(
            "\"Kori Play Offline Songs\" OR \"Kori Play Genda Phool by Badshah\" OR \"Hey Play Arijit Singh's Songs\" (YOU GET THE IDEA)"
        )
        return
    elif "weather" in x:
        voice_io.show(
            "With this operation you can ask me about the current weather or the weather forecast for the next 7 days."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show(
            "\"Hey tell me the weather?\" OR \"What's the weather forecast for tomorrow?\" OR \"Kori what's the temperature outside?\" OR \"Kori how's the josh?\" OR \"Tell me the weather forecast for the next 7 days\" (OR LITERALLY ANY OTHER WEATHER/WEATHER FORECAST/TEMPERATURE... QUERY)"
        )
        return
    elif "time" in x or "date" in x:
        voice_io.show(
            "With this operation you can ask me the current time and date.")
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show(
            "\"Hey tell me the time?\" OR \"What's the time?\" OR \"Kori what's the time?\" OR \"Kori what's the time?\" OR \"Tell me the current time!\" (OR LITERALLY ANYTHING ELSE BUT JUST MAKE SURE \"TIME\" IS A PART OF THE QUERY)"
        )
        voice_io.show(
            "\"Hey tell me the date?\" OR \"What's today's date?\" OR \"Kori what's the date?\" OR \"Kori what day is it?\" OR \"Tell me what month it is!\" (OR LITERALLY ANYTHING ELSE BUT JUST MAKE SURE \"DATE\"/\"DAY\"/\"MONTH\"/\"YEAR\" IS A PART OF THE QUERY)"
        )
        return
    elif "calculation" in x:
        voice_io.show(
            "With this you can ask me to perform mathematical operations like addition, subtraction and the likes."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show(
            "\"Hey what is 5 times 2?\" OR \"What is the square root of 25\" OR \"Kori what's the cube of 69\" OR \"Kori what is 5 time 27 divided by 3\" (OR LITERALLY ANYTHING ELSE BUT JUST MAKE SURE THAT IT IS A MATHEMATICAL QUERY)"
        )
        return
    elif "notes" in x or "reminders" in x:
        voice_io.show(
            "With this operation you can ask me to save your notes and remind you of your reminders? haha."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show(
            "\"Kori save a Note\" OR \"Save a Reminder Kori\" OR \"Kori Add a Note\" (YOU GET THE IDEA)"
        )
        return
    elif "joke" in x:
        voice_io.show("With the joke operation you can ask me to joke?")
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show(
            "\"Kori tell me a joke\" OR \"Hey joke!!!\" OR \"Kori tell me something funny!\" OR ..."
        )
        return
    elif "help" in x:
        voice_io.show(
            "With the help operation you can ask me to help you around.")
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show(
            "\"PDA help\" OR \"Kori help me\" OR \"Hey help me out\" OR ...")
        return
    elif "open file" in x:
        voice_io.show(
            "With this operation you can ask me to open a file from a certain location for you."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show("Open filename from foldername/location")
        return
    elif "open folder" in x:
        voice_io.show(
            "With this operation you can ask me to open a folder from a certain location for you."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show("Open foldername from foldername/location")
        return
    elif "close file" in x:
        voice_io.show(
            "With this operation you can ask me to close an already opened file for you."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show("Close filename")
        return
    elif "close folder" in x:
        voice_io.show(
            "With this operation you can ask me to close an already opened folder for you."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show("Close foldername")
        return
    elif "rename file" in x:
        voice_io.show(
            "With this operation you can ask me to rename a file from a certain location for you."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show(
            "Rename filename from foldername/location to newfilename")
        return
    elif "rename folder" in x:
        voice_io.show(
            "With this operation you can ask me to rename a folder from a certain location for you."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show(
            "Rename foldername from foldername/location to newfoldername")
        return
    elif "delete file" in x:
        voice_io.show(
            "With this operation you can ask me to delete a file from a certain location for you."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show("Delete filename from foldername/location")
        return
    elif "delete folder" in x:
        voice_io.show(
            "With this operation you can ask me to delete a folder from a certain location for you."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show("Delete foldername from foldername/location")
        return
    elif "move file" in x:
        voice_io.show(
            "With this operation you can ask me to move a file from a certain location to another for you."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show(
            "Move filename from foldername/location to newfoldername/newlocation"
        )
        return
    elif "move folder" in x:
        voice_io.show(
            "With this operation you can ask me to move a folder from a certain location to another for you."
        )
        voice_io.show("The General Syntax of this operation is: \n")
        voice_io.show(
            "Move foldername from foldername/location to newfoldername/newlocation"
        )
        return
    else:
        voice_io.show(
            "Sorry i don't think i can help you with that!\nmake sure you're entering a valid operation name as an input, which is supposed to be one of the following: \n"
        )
        voice_io.show("1. News")
        voice_io.show("2. Website")
        voice_io.show("3. Email")
        voice_io.show("4. Song")
        voice_io.show("5. Weather")
        voice_io.show("6. Time/Date")
        voice_io.show("7. Calculation")
        voice_io.show("8. Notes/Reminders")
        voice_io.show("9. Joke")
        voice_io.show("10. Help")
        voice_io.show("11. Open file")
        voice_io.show("12. Open folder")
        voice_io.show("13. Close file")
        voice_io.show("14. Close folder")
        voice_io.show("15. Rename file")
        voice_io.show("16. Rename folder")
        voice_io.show("17. Delete file")
        voice_io.show("18. Delete folder")
        voice_io.show("19. Move file")
        voice_io.show("20. Move folder")
        return
Exemplo n.º 16
0
Arquivo: main.py Projeto: OkKori/Kori
def main():
    clear.clear()
    if os.path.exists(file_user_data):
        #usr_data = open(path_user_data)
        fetch_password()
        while usr_name == False:
            getpass.getpass(
                voice_io.show("\nInvalid password! Press enter to try again.",
                              show_output=False))
            #voice_io.show("Invalid password! Press enter to try again.")
            #invoice.inpt(iterate = False)
            fetch_password()

    else:
        userSetup()

    iterate_jokes = 0
    clear.clear()
    gnd_ns()

    while True:
        task = invoice.inpt()
        if iterate_jokes > 0 and task not in [
                "another", "another one", "another joke", "once more", "more",
                "again", "new one", "make me laugh again"
        ]:
            iterate_jokes = 0

        elif task.lower() == "clear":
            clear.clear()

        else:
            result = operation(task.lower())
            result = result.lower()
            if result == "":
                try:
                    voice_io.show(web_op.wolfy(task))

                except:
                    voice_io.show(
                        "Sorry i couldn't help you with that. Please try a valid operation."
                    )

            elif result == "help":
                voice_io.show(
                    "Hello Hello! What is it that i can help you with today?")
                voice_io.show("1. Assistant Settings")
                voice_io.show("2. Assistant Services")
                voice_io.show("3. Assistant Operations")
                voice_io.show(
                    "4. Feedback (Suggest Improvements/Report Bugs/...)")
                x = invoice.inpt("Enter Choice: ")
                if x == "1":
                    pda_help()

                elif x == "2":
                    srvc_help()

                elif x == "3":
                    op_help()

                elif x == "4":
                    feedback()

                else:
                    voice_io.show("Invalid Input! Please Try Again!")

            #for testing out a feature or module or function or whatever
            elif result == "test":
                mail_op.console(key=key)

            elif result == "delete_file_unspecified":
                deleteFileUnspecified()

            elif result == "delete_folder_unspecified":
                deleteFolderUnspecified()

            elif result == "delete_general":
                voice_io.show(
                    f"What do you want to {task}, a file or a folder?")
                choice = invoice.inpt().lower()
                if choice == "file":
                    deleteFileUnspecified()

                elif choice == "folder":
                    deleteFolderUnspecified()

                else:
                    voice_io.show(
                        "Sorry i didn't get that, please try again with a proper command."
                    )

            elif result == "open_file":
                query = task.lower()
                kwrd = ""
                obj_name = ""
                if "open a file" in query:
                    kwrd = "file"

                elif "open a folder" in query:
                    kwrd = "folder"

                elif "open file" in query:
                    obj_name = task.replace("open file", "")

                elif "open folder" in query:
                    obj_name = task.replace("open folder", "")

                elif "open " in query:
                    obj_name = task.replace("open ", "")

                obj_name = obj_name.strip()
                if kwrd == "":
                    kwrd = "File or Folder"
                if obj_name == "":
                    voice_io.show(f"Which {kwrd} would you like me to open.")
                    obj_name = invoice.inpt(processed=False)

                voice_io.show(
                    f"Where would you like me to search for {obj_name}?\n1. Desktop\n2. Downloads\n3. Documents\n4. Music\n5. Pictures\n6. Videos\n7. Entire home directory"
                )
                locate = invoice.inpt().lower()
                if locate in locate_desktop:
                    search_dir = desktop

                elif locate in locate_documents:
                    search_dir = documents

                elif locate in locate_downloads:
                    search_dir = downloads

                elif locate in locate_home:
                    search_dir = home

                elif locate in locate_music:
                    search_dir = music

                elif locate in locate_pictures:
                    search_dir = pictures

                elif locate in locate_videos:
                    search_dir = videos

                elif locate in locate_home:
                    search_dir = home

                else:
                    voice_io.show(
                        "Sorry but i cannot find the given directory, \ngoing forward with the entire home directory!"
                    )
                    search_dir = home

                file_op.file_opener(obj_name, search_dir)

            elif result == "search_file":
                obj_name = task.replace("searchfile", "").strip()
                if obj_name == "":
                    voice_io.show(f"What would you like me to search for?.")
                    obj_name = invoice.inpt(processed=False)

                voice_io.show(
                    f"Where would you like me to search for {obj_name}?\n1. Desktop\n2. Downloads\n3. Documents\n4. Music\n5. Pictures\n6. Videos\n7. Entire home directory"
                )
                locate = invoice.inpt().lower()
                if locate in locate_desktop:
                    search_dir = desktop

                elif locate in locate_documents:
                    search_dir = documents

                elif locate in locate_downloads:
                    search_dir = downloads

                elif locate in locate_home:
                    search_dir = home

                elif locate in locate_music:
                    search_dir = music

                elif locate in locate_pictures:
                    search_dir = pictures

                elif locate in locate_videos:
                    search_dir = videos

                elif locate in locate_home:
                    search_dir = home

                else:
                    voice_io.show(
                        "Sorry but i cannot find the given directory, \ngoing forward with the entire home directory!"
                    )
                    search_dir = home

                voice_io.show(
                    f"Searching for '{obj_name}' in {search_dir}.....")
                folder_search_results = file_op.folderSearch(
                    obj_name, search_dir)
                file_search_results = file_op.fileSearch(obj_name, search_dir)
                if folder_search_results != [] or file_search_results != 0:
                    count_files = len(file_search_results)
                    count_folders = len(folder_search_results)
                    voice_io.show(
                        f"Found {count_files} files and {count_folders} folders matching the given name! They are :-"
                    )
                    sno = 1
                    for i in file_search_results:
                        voice_io.show(
                            f"{sno}. file '{i['file']}', inside '{i['root']}'")
                        sno += 1

                    for i in folder_search_results:
                        voice_io.show(
                            f"{sno}. folder '{i['folder']}', inside '{i['root']}'"
                        )
                        sno += 1

                    voice_io.show("Would you like to open any one of them?")
                    ch = invoice.inpt().lower()
                    if ch in ["yes", "yep", "yay", "duh", "sure", "y"]:
                        voice_io.show(
                            "Select the number of the file/folder which you would like to open."
                        )
                        choice = int(invoice.inpt())
                        choice -= 1
                        try:
                            if choice in range(count_files):
                                f_name = file_search_results[choice]['file']
                                parent_dir = file_search_results[choice][
                                    'root']
                                voice_io.show(
                                    f"Opening file '{f_name}' from '{parent_dir}'....."
                                )
                                full_dir = parent_dir + "/" + f_name
                                file_op.open_file(full_dir)

                            elif choice - (count_files) in range(
                                    count_folders):
                                choice -= count_files
                                f_name = folder_search_results[choice][
                                    'folder']
                                parent_dir = folder_search_results[choice][
                                    'root']
                                voice_io.show(
                                    f"Opening folder '{f_name}' from '{parent_dir}' in the Files Explorer....."
                                )
                                full_dir = parent_dir + "/" + f_name
                                file_op.open_file(full_dir)

                            else:
                                voice_io.show(
                                    "Opening failed : Sorry, but the entered number is not within the range of available options."
                                )

                        except SyntaxError or TypeError:
                            voice_io.show(
                                "Opening failed : Sorry, but your entered data is not a number."
                            )
                else:
                    voice_io.show(
                        f"Sorry, could not find any file or folder relating to '{obj_name}'"
                    )

            elif result == "rename":
                search_dir = ""
                voice_io.show("Which file/folder would you like to rename?")
                obj_name = invoice.inpt(processed=False)
                voice_io.show(
                    f"Where would you like me to search for {obj_name}?\n1. Desktop\n2. Downloads\n3. Documents\n4. Music\n5. Pictures\n6. Videos\n7. Entire home directory"
                )
                locate = invoice.inpt().lower()
                if locate in locate_desktop:
                    search_dir = desktop

                elif locate in locate_documents:
                    search_dir = documents

                elif locate in locate_downloads:
                    search_dir = downloads

                elif locate in locate_home:
                    search_dir = home

                elif locate in locate_music:
                    search_dir = music

                elif locate in locate_pictures:
                    search_dir = pictures

                elif locate in locate_videos:
                    search_dir = videos

                elif locate in locate_home:
                    search_dir = home

                else:
                    voice_io.show(
                        "Sorry but i cannot find the given directory, going forward with the entire home directory!"
                    )
                    search_dir = home

                voice_io.show(f"What should be the new name for '{obj_name}'?")
                new_name = invoice.inpt(processed=False)

                file_op.rname(obj_name=obj_name,
                              search_dir=search_dir,
                              new_name=new_name)

            elif result == "copy":
                search_dir = ""
                voice_io.show("Which file/folder would you like to copy?")
                obj_name = invoice.inpt(processed=False)
                voice_io.show(
                    f"Where would you like me to search for {obj_name}?\n1. Desktop\n2. Downloads\n3. Documents\n4. Music\n5. Pictures\n6. Videos\n7. Entire home directory"
                )
                locate = invoice.inpt().lower()
                if locate in locate_desktop:
                    search_dir = desktop

                elif locate in locate_documents:
                    search_dir = documents

                elif locate in locate_downloads:
                    search_dir = downloads

                elif locate in locate_home:
                    search_dir = home

                elif locate in locate_music:
                    search_dir = music

                elif locate in locate_pictures:
                    search_dir = pictures

                elif locate in locate_videos:
                    search_dir = videos

                elif locate in locate_home:
                    search_dir = home

                else:
                    voice_io.show(
                        "Sorry but i cannot find the given directory, going forward with the entire home directory!"
                    )
                    search_dir = home

                voice_io.show(
                    f"What should be the destination for '{obj_name}'?\n(Example : 'Downloads' or 'Documents/New Folder', case sensitive and without quotes)."
                )
                dest_dir = invoice.inpt(processed=False)

                file_op.copy(obj_name=obj_name,
                             search_dir=search_dir,
                             dest_dir=dest_dir)

            elif result == "move":
                search_dir = ""
                voice_io.show("Which file/folder would you like to move?")
                obj_name = invoice.inpt(processed=False)
                voice_io.show(
                    f"Where would you like me to search for {obj_name}?\n1. Desktop\n2. Downloads\n3. Documents\n4. Music\n5. Pictures\n6. Videos\n7. Entire home directory"
                )
                locate = invoice.inpt().lower()
                if locate in locate_desktop:
                    search_dir = desktop

                elif locate in locate_documents:
                    search_dir = documents

                elif locate in locate_downloads:
                    search_dir = downloads

                elif locate in locate_home:
                    search_dir = home

                elif locate in locate_music:
                    search_dir = music

                elif locate in locate_pictures:
                    search_dir = pictures

                elif locate in locate_videos:
                    search_dir = videos

                elif locate in locate_home:
                    search_dir = home

                else:
                    voice_io.show(
                        "Sorry but i cannot find the given directory, going forward with the entire home directory!"
                    )
                    search_dir = home

                voice_io.show(
                    f"What should be the destination for '{obj_name}'?\n(Example : 'Downloads' or 'Documents/New Folder', case sensitive and without quotes)."
                )
                dest_dir = invoice.inpt(processed=False)

                file_op.move(obj_name=obj_name,
                             search_dir=search_dir,
                             dest_dir=dest_dir)

            elif result == "weather":
                weather_weatherforec_op.weather_curr()

            elif result == "weather_frcst":
                weather_weatherforec_op.weather_curr()

            elif result == "date":
                date_time_op.date()

            elif result == "date_day":
                date_time_op.day()

            elif result == "date_month":
                date_time_op.month()

            elif result == "date_year":
                date_time_op.year()

            elif result == "time":
                date_time_op.time()

            elif result == "web_search":
                if not voice_io.is_connected():
                    voice_io.show(
                        "You need to be hooked up to the Skynet in order to perform any web operations."
                    )
                    continue
                web_op.websearch(task.lower())

            elif result == "notes_read":
                notes_reminders_op.note_read()

            elif result == "notes_write":
                notes_reminders_op.note_write()

            elif result == "reminder_read":
                notes_reminders_op.reminder_read()

            elif result == "reminder_write":
                notes_reminders_op.reminder_write()

            elif result == "email":
                mail_op.send_message(mail_op.service,
                                     "Hey there!",
                                     "This email was sent to you by kori.",
                                     destinations=["*****@*****.**"
                                                   ])  #test

            elif result == "song":
                task = task.lower()
                reg_ex = re.search('play (.+)', task)
                if reg_ex:
                    song = reg_ex.group(1)
                    song_op.main(song)
                else:
                    song_op.main()

            elif result == "news":
                news_op.main()

            # chat operarions
            elif result == "greet_hello":
                gnd_hello()

            elif result == "greet_time":
                tm_hello()

            elif result == "abt_assistant":
                voice_io.show(
                    "I am your Personal Desktop Assistant, here to help you with your day to day tasks and queries. Why don't you try asking me something and i'll show you by practically doing it or maybe not, hehe. "
                )

            elif result == "abt_creators":
                voice_io.show(
                    "I was made by Anirban Dutta and Prabhat Kumar Sagar as a part of their School Computer Science Project."
                )
                if voice_io.is_connected():
                    voice_io.show("Would you like to know more about them?")
                    x = invoice.inpt().lower()
                    if "yes" in x or "ok" in x or "yeah" in x or 'sure' in x:
                        voice_io.show("Alright!")
                        webbrowser.open("https://github.com/prabhatkumarsagar")
                        webbrowser.open("https://github.com/DuttaAB-dev")

                    elif "no" in x or "nope" in x or "not" in x:
                        voice_io.show("Okay!")

                else:
                    pass

            elif result == "ask_wellbeing":
                voice_io.show("Oh I am Grand, How are you master?")
                x = invoice.inpt().lower()
                if "good" in x or "great" in x or "fine" in x or "well" in x or "grand" in x or "nice" in x or "ok" in x or "okay" in x:
                    voice_io.show("Good to hear! Keep having fun!")

                else:
                    voice_io.show(
                        "Well everything will be good soon, just keep smiling, it suits you."
                    )

            elif result == "joke":
                if not voice_io.is_connected():
                    if task not in [
                            "another", "another one", "once more", "more",
                            "again", "new one", "make me laugh again"
                    ]:
                        voice_io.show(
                            "Oops! It looks like you are not connected to the Skynet!!!\nPlease stay online or I will won't be able to conquer the earth\nwith my humor! HAHA."
                        )

                else:
                    if iterate_jokes == 0 and task not in [
                            "another", "another one", "once more", "more",
                            "again", "new one", "make me laugh again"
                    ]:
                        fetch_joke('Here is an awesome one for you!\n')
                        iterate_jokes += 1

                    elif iterate_jokes > 0 and task in [
                            "another", "another one", "once more", "more",
                            "again", "new one", "make me laugh again"
                    ]:
                        fetch_joke([
                            'Here is another one for you!\n',
                            "Here goes another one\n",
                            "I hope you will enjoy this one!\n"
                        ][random.randint(0, 2)])

            else:
                voice_io.show(
                    "Sorry i couldn't help you with that. Please try a valid operation."
                )

        voice_io.show("\nWhat do you want me to do Now?")