Exemplo n.º 1
0
def create_file(command):
    file_name = take_command('give file name')

    if 'text' in command or 'simple' in command:
        file_name = file_name+'.txt'
    elif ' dot ' in file_name:
        file_name = file_name.replace(' dot ','.')

    new_file = open(file_name,'w')
    command = take_command(f'would you like to add something your {file_name} file')
    if 'yes' in command or 'hmm' in command or 'ok' in command or 'sure' in command:
        content = take_command('ok sir tell me what to add')
        new_file.write(content)
    new_file.close()
Exemplo n.º 2
0
def authenticate():
    response = '405'
    global user_name
    command = take_command('sir are you a new user or existing one')

    if (('new' in command) and ('exiting' in command)):
        speak('sorry sir i am unable to sir serve you')

    elif 'existing' in command or 'not new' in command or 'now a new' in command or 'old' in command:
        speak('ok sir provide your username or password to use this service')
        take_user_name()
        if user_name.strip() != '':
            speak('Enter your Password')
            password = getpass(prompt='Password: '******'new' in command:
        speak(
            'ok sir welcome to my service i will need your details to use this service'
        )
        take_user_name()
        speak('tell me your gender')
        question = [
            List('gender', message="Your Gender: ", choices=['Male', 'Female'])
        ]
        answer = prompt(question)
        speak('set a password')
        password = getpass(prompt='Password: '******'gender'])

    return response
Exemplo n.º 3
0
def take_user_name(string=''):
    global user_name
    if string == '':
        string = 'please tell me your name'
    user_name = take_command(string)
    if 'my name is' in user_name:
        user_name = user_name.replace('my name is ', '')
    elif 'i am' in user_name:
        user_name = user_name.replace('i am ', '')
Exemplo n.º 4
0
def execute_command(command):
    if 'name' in command:
        tell_name()

    elif (('up time' in command) or ('mac' in command and 'time' in command)):
        uptime()

    elif 'exit' in command or 'quit' in command:
        custom_exit()

    elif 'time' in command:
        tell_time()

    elif 'create' in command and 'file' in command:
        create_file(command)

    elif (('capture' in command or 'click' in command or 'take' in command) and
          ('photo' in command or 'selfie' in command or 'picture' in command
           or 'image' in command or 'pic' in command)):
        capture_image()

    elif 'weather report' in command and 'google' not in command and 'youtube' not in command:
        weather_report()

    elif 'play' in command and 'song' in command:
        play_song()

    elif (('search' in command or 'find' in command or 'display' in command
           or 'show' in command) and ('youtube' not in command)):
        search(command, 'google')

    elif (('search' in command or 'find' in command or 'display' in command
           or 'show' in command) and ('youtube' in command)):
        search(command, 'youtube')

    elif 'screenshot' in command:
        screenshot_name = ctime() + '.png'
        take_screen_shot(screenshot_name)
        manage_image(screenshot_name)

    elif 'open' in command and ('app' in command or 'application' in command):
        app = take_command('which application would you like to open')
        open_app(app)

    elif 'wikipedia' in command or 'wiki' in command:
        get_wiki(command)

    elif 'news' in command and 'google' not in command and 'youtube' not in command:
        get_news_feeds()

    elif feedback(command):
        return True
Exemplo n.º 5
0
def delete_image(image_name):
    answer = take_command('would you like to save this picture').strip()
    if answer == 'no' or answer == 'discard' or answer == 'never' or answer == 'dont':
        sleep(3)
        remove(image_name)
Exemplo n.º 6
0
        take_screen_shot(screenshot_name)
        manage_image(screenshot_name)

    elif 'open' in command and ('app' in command or 'application' in command):
        app = take_command('which application would you like to open')
        open_app(app)

    elif 'wikipedia' in command or 'wiki' in command:
        get_wiki(command)

    elif 'news' in command and 'google' not in command and 'youtube' not in command:
        get_news_feeds()

    elif feedback(command):
        return True


if __name__ == '__main__':

    response = initiate()
    if response == '200':
        greet()
        while True:
            print('Speak Now ...')
            command = take_command()
            if name in command:
                command = command.replace(name, '')
            print(f'you said : {command}')
            execute_command(command)
    else:
        custom_exit()