示例#1
0
 def speak(text):
     text = text.split('.')
     for t in text:
         if len(t) > 0:
             print('phrase : ' + t)
             speak(t)
             time.sleep(3)
示例#2
0
def get_question(entry1):
    x1 = entry1.get()
    if x1 != "":
        result, audible = task.search(x1)
        if audible:
            voice.speak(result)
    entry1.delete(0, 'end')
示例#3
0
def parse_video_input(input_string):
    if ("play" in input_string or "pause" in input_string):
        navigation.toggle_pause()
    elif ("channel" in input_string):
        voice.speak("The name of this channel is " + globals.page.channel)
    elif ("view" in input_string):
        voice.speak(globals.page.num_views)
    else:
        print("Sorry, this feature is not supported.")
示例#4
0
def list_videos(videos):
    output = "The first three videos are: "
    for i in range(3):
        if (i == 2):
            output += videos[i][1] + ". "
        else:
            output += videos[i][1] + ". The next video is "
    output += "Would you like to hear the rest?"
    voice.speak(output)
    continue_listing = voice.get_audio()
    if "yes" in continue_listing:
        output = ""
        for i in range(3, len(videos)):
            output += videos[i][1] + ". "
        voice.speak(output)
    else:
        return
示例#5
0
def read_articles(articles):
    output = "The first three articles are:"
    for i in range (3):
        if (i == 2):
            output += articles[i] + ". "
        else:
            output += articles[i] + ". The next article is "

    output += "Would you like to hear the rest?"
    voice.speak(output)
    continue_listing = voice.get_audio()
    if "yes" in continue_listing:
        output = ""
        for i in range (3, len(articles)):
            output += articles[i] + ". "
        voice.speak(output)
    else:
        return
示例#6
0
def main():
    with open('credentials.json', 'r') as file:
        CREDENTIALS = json.load(file)

    with open('config.json', 'r') as file:
        CONFIG = json.load(file)
        subreddit_name = CONFIG['subreddit']
        limit = CONFIG['limit']

    reddit = praw.Reddit(**CREDENTIALS)
    chosen_subreddit = reddit.subreddit(subreddit_name)
    submissions = chosen_subreddit.hot(limit=limit)
    look_up, choices, submissions_store = make_title_index_dict(submissions)
    while True:
        submission = make_menu(look_up, choices, submissions_store)
        print('Playing: {}'.format(submission.title))
        msg = submission.selftext
        speak(msg)
示例#7
0
def misc(query):

    if 'time' in query.lower():
        str_time = datetime.datetime.now().strftime("%H:%M:%S")
        voice.speak(f"Current time is {str_time}")

    elif 'joke' in query.lower():
        joke = pyjokes.get_joke()
        voice.speak(joke)

    elif any([k in query.lower() for k in thank_keys]):
        voice.speak(random.choice(thank_reply))

    elif 'bye' in query.lower():
        voice.speak(random.choice(bye_keys))
        sys.exit()

    else:
        voice.speak("Aah man, what are you talking about?")
示例#8
0
def listen():
    """
    Listen to a microfone and try to recognize the words.
    :param: None
    :returns: The text heard.
    :raises: None so far.
    
    """
    text = 'não entendi.Repita!'
    r = sr.Recognizer()  # initialize recognizer
    r.energy_threshold = 5000
    with sr.Microphone(
    ) as source:  # mention source it will be either Microphone or audio files.
        audio = r.listen(source)  # listen to the source
        try:
            text = r.recognize_google(
                audio, language='pt-BR'
            )  # use recognizer to convert our audio into text part.
        except:
            pass

    voice.speak(text)
def search(query):
    voice.speak("Searching on wikipedia")
    try:
        query = query.replace('Wikipedia', '')

        results = wikipedia.summary(query, sentences=2)
        print(results)  # for testing purpose only
        voice.speak(f"According to wikipedia, {results}")

    except:
        voice.speak("No result found on wikipedia!")
示例#10
0
def parse_article_input(input_string):
    if("read" in input_string):
        if("summary" in input_string):
            voice.speak(globals.page.summary)
        elif("article" in input_string):
            voice.read(globals.page.body_text)
        else:
            print("Sorry that item was not found")
    elif("who" in input_string):
        #TODO: only prints first author if there is one. Might break if no authors
        print(globals.page.authors[0])
        voice.speak("The author is " + globals.page.authors[0])
    elif("when" in input_string or "date" in input_string):
        print(globals.page.date)
        voice.speak("This article was published on " + globals.page.date)
    else:
        print("Sorry, this feature is not supported.")
示例#11
0
def prompt():
    if (globals.website == "nytimes"):
        if (globals.page_type == "Article"):
            voice.speak("The title of this article is " +
                        globals.page.headline)
            voice.speak(
                "Say: \"read me the summary\" or \"read me the article\" to begin."
            )
        elif (globals.page_type == "Home"):
            voice.speak(
                "You are on the homepage of the New York Times website.")
            if (globals.page.headline != ""):
                voice.speak("The headline is " + globals.page.headline)
            voice.speak("There are " + str(len(globals.page.articles)) +
                        " articles featured on this page.")
        elif (globals.page_type == "Navigation"):
            voice.speak("The featured article in this section is: " +
                        globals.page.articles[0])
            voice.speak("There are " + str(len(globals.page.articles)) +
                        " articles featured on this page.")
    elif (globals.website == "youtube"):
        if (globals.page_type == "YoutubeHome"):
            voice.speak("You are on the homepage of Youtube.")
            voice.speak("There are " + str(len(globals.page.videos)) +
                        " videos featured on this page.")
            voice.speak("Say \"search\" to search for a video.")
        elif (globals.page_type == "YoutubeResults"):
            voice.speak("There are " + str(len(globals.page.videos)) +
                        " featured results.")
示例#12
0
def run(c, status):

    commandDone = False

    if c[0:7] == "Cobalt " or c[
            0:
            7] == "Kobalt ":  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

        if c[7:7 + 8] == "question":

            try:
                voice.speak(wikipedia.summary(c[7 + 9:]))
            except:
                voice.speak("No resoults found")

        elif c[7:10] == "run":

            os.system(c[10:])

        elif c[7:14] == "launch " or c[7:13] == "lunch ":

            found = False
            for program in u.programs:
                if program.name == c[14:]:
                    voice.speak(f"Launching {program.name}")
                    s.Popen(program.command)
                    found = True

            if found == False:

                voice.speak("No such program!")

        elif c[7:11] == "stop":

            voice.speak("Do you really want me to stop?")
            a = voice.getaudio()
            print(a)
            if a == "Yes" or a == "yes":

                voice.speak("OK. Goodbye")
                raise Exception("exit")

            else:

                voice.speak("OK")

        elif c[7:7 + 15] == "you are stupid":

            voice.speak(
                "Thank you but you are more stupid than me. So shut up")

        elif c[7:7 + 13] == "math question":

            instructions = c[7 + 13:]
            voice.speak("the awnser is" + str(m.execute(instructions)))

        elif c[7:7 + 11] == "who are you":

            voice.speak(
                "I am Cobalt. I am a robot made by Hawk_x6x. I am made to help you."
            )

        elif c[7:7 + 4] == "help":

            info = "I am Cobalt. My commands are question. run. launch. stop."

            voice.speak(info)

        else:

            print("i dont understand you")
            voice.speak("I dont understand you?")

    elif status == True:  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

        if c[0:8] == "question":

            try:
                voice.speak(wikipedia.summary(c[9:]))
            except:
                voice.speak("No resoults found")

        elif c[0:3] == "run":

            os.system(c[10:])

        elif c[0:7] == "launch ":

            found = False
            print(c[7:])
            for program in u.programs:
                if program.name == c[7:]:
                    voice.speak(f"Launching {program.name}")
                    s.Popen(program.command)
                    found = True

            if found == False:

                voice.speak("No such program!")

        elif c[0:4] == "stop":

            voice.speak("Do you really want me to stop?")
            a = voice.getaudio()
            print(a)
            if a == "Yes" or a == "yes":

                voice.speak("OK. Goodbye")
                raise Exception("exit")

            else:

                voice.speak("OK")

        elif c[0:15] == "you are stupid":

            voice.speak(
                "Thank you but you are more stupid than me. So shut up")

        elif c[0:13] == "math question":

            instructions = c[13:]
            voice.speak("the awnser is" + str(m.execute(instructions)))

        elif c[0:11] == "who are you":

            voice.speak(
                "I am Cobalt. I am a robot made by Hawk_x6x. I am made to help you."
            )

        elif c[0:4] == "help":

            info = "I am Cobalt. My commands are question. run. launch. stop."

            voice.speak(info)

        else:

            print("i dont understand you")
            voice.speak("I dont understand you?")

    if c[:6] == "Cobalt" or c[:6] == "Kobalt" and len(c) == 6:

        commandDone = True
        voice.speak("Yes I am listening")

    else:

        pass

    return commandDone
示例#13
0
import datetime, pytz, voice

def current_time():
  tz = pytz.timezone("US/Pacific")
  
  s = "The time is now " + datetime.datetime.now(tz).strftime("%I:%M %p")

  return s  

if __name__ == "__main__":
  voice.speak(current_time())
示例#14
0
文件: main.py 项目: sudeepsalgia/ITSP
            point_new = tuple(find_minimum_ycord(pointOfFingers))
            if distance(point_new, point_prev) > 50:
                if point_new[0] - point_prev[0] > 0 and point_new[1] - point_prev[1] > 0:
                    l = "Z"
                elif point_new[0] - point_prev[0] < 0 and point_new[1] - point_prev[1] > 0:
                    l = "J"
        print l
        cv2.imshow("result", images[l])
        point_prev = tuple(find_minimum_ycord(pointOfFingers))
        frequency_of_finger = [0, 0, 0, 0, 0, 0]
        frequency_dict = {}
        if l != l_prev:
            if l == "00":
                pass
            else:
                voice.speak(l)
                l_prev = l
    else:
        if numberOfFingers < 6:
            frequency_of_finger[numberOfFingers] += 1
        if l not in frequency_dict.keys():
            frequency_dict.update({l: 1})
        else:
            frequency_dict[l] += 1

    x,  y, w, h = cv2.boundingRect(contours[pos])
    cv2.rectangle(im, (x, y), (x+w, y+h), (0, 255, 0), 2)
    cv2.imshow("dilate", dilated)
    cv2.imshow("im", im)

    k = cv2.waitKey(5)
示例#15
0
def run(c):

    if c[0:7] == "Cobalt " or c[0:7] == "Kobalt ":

        if c[7:7+8] == "question":

            try:
                voice.speak(wikipedia.summary(c[7+9:]))
            except:
                voice.speak("No resoults found")

        elif c[7:10] == "run":
            
            os.system(c[10:])

        elif c[7:14] == "launch " or c[7:13] == "lunch ":
            
            found = False
            print(c[14:])
            for program in u.programs:
                if program.name == c[14:]:
                    voice.speak(f"Launching {program.name}")
                    s.Popen(program.command)
                    found = True

            if found == False:
                
                voice.speak("No such program!")

        elif c[7:11] == "stop":

            voice.speak("Do you really want me to stop?")
            a = voice.getaudio()
            print(a)
            if a == "Yes" or a == "yes":
                
                voice.speak("OK. Goodbye")
                sys.exit()

            else:
                
                voice.speak("OK")

        elif c[7:7+15] == "you are stupid":

            voice.speak("Thank you but you are more stupid than me. So shut up")

        elif c[7:7+11] == "who are you":

            voice.speak("I am Cobalt. I am a robot made by Hawk_x6x. I am made to help you.")

        elif c[7:7+4] == "help":

            info = "I am Cobalt. My commands are question, run, launch, stop."

            voice.speak(info)

        else:

            print("i dont understand you")
            voice.speak("I dont understand you?")

    else:
        
        pass
示例#16
0
def youtube_search():
    voice.speak("What would you like to search for?")
    #search_keywords = input()
    search_keywords = voice.get_audio()
    voice.speak("Searching for: " + search_keywords)
    navigation.search(search_keywords)
def start(query):

    # VS code
    if 'code' in query.lower() or 'vs code' in query.lower():
        vscode_path = r"C:\Users\Admin\AppData\Local\Programs\Microsoft VS Code\Code.exe"
        os.startfile(vscode_path)
        voice.speak("Happy Hacking!")

    # Spotify
    elif 'spotify' in query.lower():
        spotify_path = r"C:\Users\Admin\AppData\Roaming\Spotify\Spotify.exe"
        os.startfile(spotify_path)
        voice.speak("Chill")

    # Chrome
    elif 'chrome' in query.lower():
        chrome_path = r"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
        os.startfile(chrome_path)
        voice.speak("I have opened chrome browser")

    # Internet Explorer
    elif 'internet explorer' in query.lower():
        voice.speak("Do you really want to open Internet Explorer")
        query = voice.takeCommand()

        if 'yes' in query.lower():
            explorer_path = r"C:\Program Files\Internet Explorer\iexplore.exe"
            os.startfile(explorer_path)
            voice.speak(
                "Here comes world's best browser......to download other browsers"
            )
            voice.speak("hahaha")
        else:
            voice.speak("good choice")
            voice.speak("so, is there any job for me?")

    # Sumblime text editor
    elif 'sublime' in query.lower():
        sublime_path = r"E:\Installed Softwares\Sublime Text 3\sublime_text.exe"
        os.startfile(sublime_path)
        voice.speak("Done")

    # BlueStack
    elif 'bluestack' in query.lower():
        bluestack_path = r"C:\Program Files\BlueStacks\Bluestacks.exe"
        os.startfile(bluestack_path)
        voice.speak("Here comes your emulator!")

    # Discord
    elif 'discord' in query.lower():
        discord_path = r"C:\Users\Admin\AppData\Local\Discord\Update.exe --processStart Discord.exe"
        os.startfile(discord_path)
        voice.speak("Here you go...")
示例#18
0
chatbot = ChatBot("Donna",
  logic_adapters=[
        
           "chatterbot.logic.BestMatch"

    ] ,read_only=True)

trainer = ChatterBotCorpusTrainer(chatbot)


trainer.train(
    "chatterbot.corpus.english.test"
)

voice.speak("Hi Its Donna,How may I help you?")

def textInput():
  userInput = input("You: ")
  get_answer(userInput)
  # userInput = voice.listen()
  #print("You : " ,userInput)
def get_answer(userInput):
  if(userInput.strip()=="bye"):
    print("Donna: Bye! have a nice day.")
  else :
    response = chatbot.get_response(userInput)
   #voice.speak(response)
    return response

def text2Voice():
示例#19
0
def open_website(query):
    
    # Opening Wikipedia website
    if 'wikipedia' in query.lower():
        voice.speak("Opening wikipedia")
        webbrowser.open("wikipedia.com")
    
    # Opening Youtube website
    elif 'youtube' in query.lower():
        voice.speak("Opening Youtube!")
        webbrowser.open("youtube.com")
    
    # Google
    elif 'google' in query.lower():
        voice.speak("Opening google")
        webbrowser.open("Google")

    # Pragmatic programmer
    elif 'pragmatic programmer' in query.lower():
        voice.speak("Opeing Pragmatic programmer website")
        webbrowser.open("pragmaticprogrammer.in")

    # StackOverflow
    elif 'stack overflow' in query.lower():
        voice.speak("Opening Stack Over flow")
        webbrowser.open("stackoverflow.com")

    # GitHub
    elif 'github' in query.lower():
        voice.speak("Opening git hub!")
        webbrowser.open("github.com")
    
    # Netflix
    elif 'netflix' in query.lower():
        voice.speak(" opening netflix")
        webbrowser.open("netflix.com")
    
    else:
        voice.speak("Sorry, your desired website is not in my database!")
示例#20
0
# AWS Voice assitant Provisioning tool
#'''This tool is to control AWS cloud using voice assistanant'''
from voice import speak, listens, change_voice
from aws import ec2, networkAndSecurity, ebs, cloudFront, s3Buckets
# in Time module sleep is used to wait for few seconds
import time

change_voice()  #Change from male to female
speak("Hey,,, Vinod, How can i help you")  #intro


def speakAgain():  #Start Speaking
    audio = listens()
    return audio


def performTask(audio):  #main Tasks
    def aws(cmd):
        # 1) Create new key pair
        if ("create" in cmd or "launch" in cmd) and ("key" in cmd
                                                     or "keypad" in cmd):
            speak("Enter Key pair name")
            key = input("Key Name : ")
            networkAndSecurity.keyCreate(key)
            speak("Key pair {} Successfully created.".format(key))
        # 2) Create new Security group
        elif ("create" in cmd or "launch"
              in cmd) and ("security" in cmd or "security-group" in cmd):
            speak("Enter group name and description")
            grp = input("Group Name : ")
            des = input("Description : ")
示例#21
0
import time
import speech_recognition as sr
import pyjokes

import wish
import voice
import websites
import wiki
import song
import application
import weather
import news
import misc

if __name__ == '__main__':
    voice.speak(wish.wish())
    while True:
        query = voice.takeCommand()

        if 'open' in query.lower():
            websites.open_website(query)

        elif 'wikipedia' in query.lower():
            wiki.search(query)

        elif 'play' in query.lower() and 'music' in query.lower():
            song.play()

        elif 'start' in query.lower():
            application.start(query)
示例#22
0
 def aws(cmd):
     # 1) Create new key pair
     if ("create" in cmd or "launch" in cmd) and ("key" in cmd
                                                  or "keypad" in cmd):
         speak("Enter Key pair name")
         key = input("Key Name : ")
         networkAndSecurity.keyCreate(key)
         speak("Key pair {} Successfully created.".format(key))
     # 2) Create new Security group
     elif ("create" in cmd or "launch"
           in cmd) and ("security" in cmd or "security-group" in cmd):
         speak("Enter group name and description")
         grp = input("Group Name : ")
         des = input("Description : ")
         networkAndSecurity.addSecurityGroup(grp, des)
         speak("Security Group with name {} iS successfully created".format(
             grp))
     # 3) Create new instance
     elif ("create" in cmd
           or "launch" in cmd) and ("instance" in cmd or "laptop" in cmd
                                    or "ins" in cmd):
         speak("Enter image ID")
         img = input("Image ID : ")
         speak("Enter instance type")
         typ = input("Instance Type:")
         speak("Enter subnet ID")
         subnet = input("Subnet ID : ")
         speak("Enter Security group ID")
         grp = input("Security group ID :")
         converter.say("Enter key name ")
         keyname = input("Key Name : ")
         ec2.cerate(img, typ, subnet, grp, keyname)
         speak("Instance successfully created.")
     # 4) Termination of instance
     elif ("terminate" in cmd or "delete" in cmd
           or "destroy" in cmd) and ("instance" in cmd or "laptop" in cmd
                                     or "ins" in cmd):
         speak("Enter Instance ID")
         ids = input("Instance ID : ")
         ec2.terminate(ids)
         print("Instance ID {} successfully Terminated.".format(ids))
         speak("Instance successfully Terminated.")
     # 5) Display list of instances
     elif ("show" in cmd or "display" in cmd or "view" in cmd
           or "list" in cmd) and ("instance" in cmd or "laptop" in cmd
                                  or "ins" in cmd):
         speak("Please, wait Displaying list")
         ec2.list()
         speak("The following are the instances.")
         time.sleep(4)
     # 6) Creation a volume
     elif ("create" in cmd or "launch" in cmd) and ("volume" in cmd
                                                    or "EBS voluem" in cmd):
         speak("Enter Size of EBS volume")
         size = input("EBS size : ")
         ebs.volCreate(size)
         print("Volume Is created size of " + size)
         speak("Volume Is created size of {}".format(size))
     # 7) Attach Volume to a instance
     elif ("attach" in cmd
           or "join" in cmd) and ("volume" in cmd or "EBS voluem" in cmd
                                  or "backet" in cmd):
         speak("Enter Volum id")
         volId = input("Enter volum id : ")
         speak("Enter Instance id")
         insId = input("Enter Instance Id : ")
         ebs.volAttach(volId, insId)
         print("Volume attached to a instance. \nInstance ID " + insId +
               "\n Volume ID " + volId)
         speak("Volume attached to a instance.")
     # 8) Run/start instance
     elif ("start" in cmd
           or "run" in cmd) and ("instance" in cmd or "laptop" in cmd
                                 or "ec2" in cmd or "ins" in cmd):
         speak("Please enter instance id. ")
         data = input("EC2 ID:")
         ec2.start(data)
         print("Instance Started.\nInstance ID : " + data)
         speak("Instance Started.")
     # 9) Stop instance
     elif ("stop" in cmd
           or "exit" in cmd) and ("instance" in cmd or "laptop" in cmd
                                  or "ec2" in cmd or "ins" in cmd):
         speak("Please enter instance id. ")
         data = input("EC2 ID:")
         ec2.stop(data)
         print("Intance Stopped. \nInstance ID {}".format(data))
         speak("Intance Stopped.")
     # 10) Create Cloud Front Distribution
     elif ("create" in cmd or "launch" in cmd) and ("cloud front" in cmd
                                                    or "cloudfront" in cmd):
         speak("Please enter Origilnal domain name. ")
         domainName = input("Enter Domain Name : ")
         cloudFront.createCloudFront(domainName)
         print("New CloudFront distribution is created")
         speak("New CloudFront distribution is created")
     # 11) Create New S3 Buckets
     elif ("create" in cmd or "launch" in cmd) and ("S3 bucket" in cmd
                                                    or "bucket" in cmd):
         prt = ""
         while (True):
             # If Error occured goes to Except part
             try:
                 BucketName = input("Enter Bucket Name : ")
                 speak("Please enter {} Bucket name. ".format(prt))
                 s3Buckets.createS3(BucketName)
                 prt = "New Bucket is created"
                 print(prt)
                 speak(prt)
                 break
             # Display message if Exception Occured
             except Exception as e:
                 print("Oops!", e.__class__, "occurred.")
                 prt = "Oops! Name Already exists!"
                 print(prt)
                 speak(prt)
                 prt = "Unique"
     # 12) Uploading a file or folder to Bucket
     elif ("upload" in cmd or "add"
           in cmd) and ("file" in cmd or "folder" in cmd or "image" in cmd
                        or "picture" in cmd or "document"
                        in cmd) and ("bucket" in cmd or "s3 bucket" in cmd):
         prt = ""
         while (True):
             # If Error occured goes to Except part
             try:
                 print(subprocess.getoutput("DIR /W"))
                 speak(
                     "Please enter {} Location,  orelse select File or folder name, from above list. "
                     .format(prt))
                 fileLoc = input(
                     "Enter {} Location orelse select  File or folder name from above list : "
                     .format(prt))
                 s3Buckets.listS3()
                 speak("Please enter {} Bucket name, from above list. ".
                       format(prt))
                 bucketName = input("Type Bucket name from above list : ")
                 res = s3Buckets.uploadFile()
             # Display message if Exception Occured
             except Exception as e:
                 print("Oops!", e.__class__, "occurred.")
                 prt = "Oops! Something gone wrong!"
                 print(prt)
                 speak(prt)
                 prt = "Valid"
     # 13) Delete/Remove Cloud front Distribution
     elif ("delete" in cmd or "remove" in cmd) and ("cloud front" in cmd
                                                    or "cloudfront" in cmd):
         prt = ""
         while (True):
             # If Error occured goes to Except part
             speak(
                 "Please enter {} Cloudfront distribution id. ".format(prt))
             cloudFrontID = input(
                 "Enter {} Cloudfront distribution id : ".format(prt))
             # Taking complete JSON to find if-match ID
             try:
                 delRes = cloudFront.deleteCloudFront(cloudFrontID)
                 print(delRes)
             # Display message if Exception Occured
             except Exception as e:
                 print("Oops! ", e, " occurred.")
     # 14) Show a list of CloudFront Distribution
     elif ("show" in cmd or "display" in cmd or "view" in cmd or "list"
           in cmd) and ("cloud front" in cmd or "cloudfront" in cmd):
         ptr = "The following are list of CloudFront"
         speak("Please, wait Displaying list")
         print(ptr)
         speak(ptr)
         cloudFront.listCloudFront()
         time.sleep(3)
     # 15) Show list of Files/folder in a backet
     elif ("show" in cmd or "display" in cmd or "view" in cmd or "list"
           in cmd) and ("file" in cmd or "folder" in cmd or "image" in cmd
                        or "picture" in cmd or "document"
                        in cmd) and ("bucket" in cmd or "s3 bucket" in cmd):
         speak("Please, wait Displaying list")
         print("\n\t\t\t--- Buckets ---\n")
         s3Buckets.listS3()
         ptr = "Enter the Bucket Name from above list "
         speak(ptr)
         bucketName = input("\n\t\t{} : ".format(ptr))
         ptr = "The following are list of files or folders available in " + bucketName + " bucket."
         print("\n\t", ptr, "\n")
         speak(ptr)
         print("\t\t\t--- ", bucketName, " ---\n")
         s3Buckets.listS3files(bucketName)
     # 16) Show a list of S3 buckets
     elif ("file" not in cmd or "folder" not in cmd or "image" not in cmd
           or "picture" not in cmd or "document" not in cmd) and (
               "show" in cmd or "display" in cmd or "view" in cmd or "list"
               in cmd) and ("S3 bucket" in cmd or "bucket" in cmd):
         ptr = "The following are list of Buckets available."
         speaka("Please, wait Displaying list")
         print("\n\t", ptr, "\n")
         speak(ptr)
         print("\t\t\t--- Buckets ---\n")
         s3Buckets.listS3()
     # 17) Remove files/folders from Buckets
     elif ("delete" in cmd or "remove"
           in cmd) and ("file" in cmd or "folder" in cmd or "image" in cmd
                        or "picture" in cmd or "document"
                        in cmd) and ("bucket" in cmd or "s3 bucket" in cmd):
         while True:
             try:
                 ptr = "The following are list of Buckets available."
                 speak(", Displaying a list.")
                 print("\n\t\t\t--- Buckets ---\n")
                 s3Buckets.listS3()
                 ptr = "Please enter bucket name from above list"
                 speak(ptr)
                 bucketName = input("\n{} : ".format(ptr))
                 check = s3Buckets.listS3files(bucketName)
                 if "error" in check:
                     print(check)
                     speak("Sorry Dear, Bucket Name is not exists.")
                     speak("Please Enter Valid")
                     continue
                 print(check)
                 print("\t\t\t--- ", bucketName, " ---")
                 ptr = "Type File Name to remove"
                 speak(ptr)
                 fileName = input("\n{} : ".format(ptr))
                 delFile = s3Buckets.deleteS3files(bucketName, fileName)
             except Exception as e:
                 print("Oops! ", e, " occurred.")
                 prt = "Oops! Something gone wrong!"
                 print(prt)
                 speak(prt, ". Check Bucket or file name.")
     # 18) Delete or Remove Buckets
     if ("delete" in cmd or "remove" in cmd) and ("bucket" in cmd
                                                  or "s3 bucket" in cmd):
         while True:
             try:
                 ptr = "The following are list of Buckets available."
                 speak(", Displaying a list.")
                 print("\n\t\t\t--- Buckets ---\n")
                 s3Buckets.listS3()
                 ptr = "Please enter bucket name from above list, to remove a bucket"
                 speak(ptr)
                 bucketName = input("\n{} : ".format(ptr)) or "."
                 check = deleteS3Bucket(bucketName)
                 if "BucketNotEmpty" in check:
                     speak(
                         "Sorry Dear, Bucket is not empty first empty Files."
                     )
                     continue
                 elif "Error" in check or "error" in check:
                     print("Please enter Valid.")
                     speak("Sorry Dear, Bucket Name is not exists.")
                     speak("Please enter Valid.")
                     continue
                 if "del" in check or "Del" in check:
                     prt = "Success!!, Bucket is removed."
                     speak(prt)
                 break
             except Exception as e:
                 prt = "Oops! Something gone wrong!"
                 speak(prt)
         # Task is not available
         else:
             print("sorry, There is no such task..")
             speak("sorry, There is no such task..")
示例#23
0
def init():
    voice.speak("Hello, where would you like to go?")
示例#24
0
def read_headers(headers):
    output = ""
    for header in headers:
        output += header + ", "
    voice.speak("The headers are: " + output)
示例#25
0
def play():
    song = random.randint(0, len(songs) - 1)
    print(f"Playing: {songs[song]}")  # for testing purpose only
    voice.speak(f"Playing {songs[song]}")

    os.startfile(os.path.join(music_dir, songs[song]))
示例#26
0
import subprocess, urllib
import voice

s = subprocess.check_output(["/usr/games/fortune", "-o", "-s", "-n", "100"])
s = s.replace("\n", " ")
s = s.replace("\t", " ")
s = s.replace("\"", "")

voice.speak(s)
示例#27
0
def receiveVoice(ques):
    answer = batcheet.get_answer(ques)
    voice.speak(answer)
    msg_list.insert(END, answer)