def run(self): ps('start.wav') self.t = int(self.e5.get()) u = open(self.uname, mode='r') p = open(self.pname, mode='r') for line in u: self.username = line #.replace('\n', ' ') for x in p: self.password = x #.replace('\n', ' ') print("Username :"******"Password :"******"[+] Password found - " + self.password) self.scr.insert( INSERT, "[+] Password found - " + self.password) sys.exit() else: print("Not valid " + self.password) self.scr.insert(INSERT, "Not valid " + self.password) except: print("Can not connect.") self.scr.insert(INSERT, "Can not connect.")
def corona_virus(language: str) -> None: try: # URL do World Meters com os dados do Corona Virus url = "https://www.worldometers.info/coronavirus/" site = get(url) # Realizando a requisição # Transformando a resposta em um HTML legível com BeautifulSoup soup = BeautifulSoup(site.text, 'html.parser') # Lista com as informações array = soup.findAll(attrs={'class': 'maincounter-number'}) array_formated = [] # Como as informações são em inglês, transforma-se as vírgulas em pontos e acrescentado em um novo array for text in array: array_formated.append(text.span.text.replace( ',', '.')) # Trocando a vírgula por um ponto # Criação da variável de áudio informativo dependendo da linguagem if language == 'pt-br': audio = f'Casos {array_formated[0]}, Mortes {array_formated[1]}, Recuperados {array_formated[2]}' elif language == 'en': audio = f'Cases {array_formated[0]}, Death {array_formated[1]}, Recovered {array_formated[2]}' cria_audio(audio, 'cases', language) # Criação do áudio ps(f'{path}/audios_{language}/cases.mp3') # Reprodução os.remove(f'{path}/audios_{language}/cases.mp3' ) # Exclusão do áudio para evitar sopreposição except: reproduction_audio('erro', language) # Reproduz áudio de erro
def text_to_speech(input_text): # Instantiates a client client = tts.TextToSpeechClient() # Set the text input to be synthesized synthesis_input = tts.SynthesisInput(text=input_text) # Build the voice request, select the language code ("en-US") and the ssml # voice gender ("neutral") voice = tts.VoiceSelectionParams(language_code='en-US', ssml_gender=tts.SsmlVoiceGender.FEMALE) # Select the type of audio file you want returned audio_config = tts.AudioConfig(audio_encoding=tts.AudioEncoding.LINEAR16) # Perform the text-to-speech request on the text input with the selected # voice parameters and audio file type response = client.synthesize_speech(input=synthesis_input, voice=voice, audio_config=audio_config) # The response's audio_content is binary. path = input_text.replace('?', '') + '.wav' with open(path, 'wb') as out: # Write the response to the output file. out.write(response.audio_content) print('Audio content written to file ' + path) # play the file ps(path) os.remove(path)
def sleep_hiyoka(): global sleeping reply = list(greets.keys())[1] print(reply) ps(greets[reply]) ps('./sounds/entering_sleep_mode') sleeping = 1
def playHomeRun(self, newScoring, teamID, game, printed): if ("homers" in newScoring[-1]): playerName = newScoring[-1].split(" homers")[0] if (playerName in sa.roster(teamID) and game['current_inning'] == self.getCurrentInning(newScoring) and game['inning_state'] == self.getCurrentInningState(newScoring) and not printed): print(newScoring[-1]) ps('SEE YA.mp3') printed = True return printed
def alphabetToMorseBeep(message): for i in range(len(message)): if (message[i] == "."): ps(dot) elif (message[i] == "-"): ps(dash) else: time.sleep(0.2) print("")
def my_tts(aud_txt): if aud_txt.startswith('http') == True: say = 'Here is a link to a cat picture!, you shoud copy this link and paste in the browser to view the picture.' else: say = re.sub(r'\w+:\/{2}[\d\w-]+(\.[\d\w-]+)*(?:(?:\/[^\s/]*))*', 'the link on the screen', aud_txt) tts(text=say, lang='en', slow=False).save('say.mp3') ps('say.mp3') os.remove("say.mp3")
def transmit(input_morse): dot = os.path.join(current_directory, 'audio', 'dot.mp3') dash = os.path.join(current_directory, 'audio', 'dash.mp3') print('Transmitting message:', input_morse) for t in input_morse: if t == '.': ps(dot) elif t == '-': ps(dash) else: time.sleep(0.2) print('\nTransmission complete')
def alphabetToMorseBeepSpecial(message): for i in range(len(message)): if (message[i] == "."): print(".", end='', flush=True) ps(dot) elif (message[i] == "-"): print("-", end='', flush=True) ps(dash) else: print(" ", end='', flush=True) time.sleep(0.2) print("")
def score_tracker(r, w, o, q): new_scores = live_cricket_status() if (new_scores[0] - r == 1): print('Just a single') r = r + 1 print('Live Score ' + str(q) + ':' + str(r) + '\\' + str(new_scores[1])) print('Overs:', new_scores[2]) ps('boundary.mp3') elif (new_scores[0] - r == 4): print('A Boundary!!!') ps('boundary.mp3') r = r + 4 print('Live Score ' + str(q) + ':' + str(r) + '\\' + str(new_scores[1])) print('Overs:', new_scores[2]) elif (new_scores[0] - r == 6): print('it\'s a six') ps('sixer.mp3') r = r + 6 print('Live Score ' + str(q) + ':' + str(r) + '\\' + str(new_scores[1])) print('Overs:', new_scores[2]) elif (new_scores[1] - w == 1): print('A wicket has fallen') ps('wicket.mp3') print('Live Score ' + str(q) + ':' + str(new_scores[0]) + '\\' + str(new_scores[1])) print('Overs:', new_scores[2]) elif (new_scores[0] - r == 0 or new_scores[2] - o == 0): r = r o = o score_tracker(r, w, o, q)
def play(self): print("I am in.") # Make sure data is in array. #Check status. if 'scan' == self.c[0].lower(): self.host = self.c[1].lower() h = ('http://www.' + self.host + ".com") r = requests.get(h) print(h) print('\nStatus Code: ', str(r.status_code)) self.scr.insert(INSERT, '\nHost is alive.\n') self.scr.insert(INSERT, h) self.scr.insert(INSERT, "\n") self.scr.insert(INSERT, str(r.status_code)) p = (str(r.status_code) + ".wav") print(p) ps(p) if 'source' == self.c[1].lower(): self.host = self.c[0].lower() h = ('http://www.' + self.host + ".com") r = requests.get(h) print(r.text) print(str(r.status_code)) self.scr.insert(INSERT, '\n Page Source: \n', str(r.text)) ps('igotit.wav') self.Information() #self.Fuction() #if 'email' in self.c[1]: # print("I am in Email.") if 'extract' == self.c[0].lower(): if 'email' or 'emails' == self.c[1].lower(): if 'from' == self.c[2].lower(): print(self.c[3].lower()) self.host = self.c[3].lower() h = ('http://www.' + self.host + ".com") r = requests.get(h) r = re.findall(r'@\w+.\w+', str(r.text)) for line in r: print(line) self.scr.insert(INSERT, line) print("These are emails.") else: print("No sufficient data available")
def speak(string): tts = gTTS(string, lang='tr') rand = random.randint(1, 9999) file = ('auido-' + str(rand) + '.mp3') tts.save(file) if ps(file): os.remove(file) else: os.remove(file)
def Fuction(self): with sr.Microphone() as source: print("Say Something Akash") text = self.r.listen(source) try: print("You Said :" + self.r.recognize_google(text)) self.scr.insert(INSERT, self.r.recognize_google(text)) cmd = self.r.recognize_google(text) #c = (cmd+"()") #print(c) self.c = cmd.split(" ") for x in self.c: i = (x + ".wav") ps(i) except: pass
def clima(language: str) -> None: try: # URL da página de pesquisa do clima do Google url = "https://www.google.com/search?sxsrf=ALeKk03XRgXBBQ0xMOdRKjfYMz17naVuJQ%3A1586300662125&ei=9gaNXumgB5Ke5OUPlcCEwAQ&q=temperatura+agora+governador+valadares&oq=temperatura+atual+de+gover&gs_lcp=CgZwc3ktYWIQAxgAMgYIABAWEB4yBQgAEM0CMgUIABDNAjIFCAAQzQIyBQgAEM0COgQIABBHOgcIIxDqAhAnOgQIIxAnOgQIABBDOgUIABCDAToCCAA6BAgAEAo6BwgAEEYQgAJKNQgXEjEwZzQ4NWczMDdnMjUwZzI1M2cyNDdnMzM0ZzI1MmcyNjRnNDM2ZzMzNGcyNDJnMjM0Sh0IGBIZMGcxZzFnMWcxZzFnMWcxZzFnMWc1ZzVnOVDbljVYsbc1YKjANWgCcAR4AYAB7QOIAco-kgEIMi0xNC4zLjiYAQCgAQGqAQdnd3Mtd2l6sAEK&sclient=psy-ab" site = get(url) # Realizando a requisição # Transformando a resposta em um HTML legível com BeautifulSoup soup = BeautifulSoup(site.text, 'html.parser') # Procurando o elemento de descrição do tempo a partir de outros que tem a mesma das suas classes descricao = soup.findAll(attrs={'class': 'BNeawe tAd8D AP7Wnd'}) descricao = descricao[len(descricao) - 1].text # Texto do último elemento (dia atual) # Retirando a data e o horário, sobrando somente a descrição do tempo descricao = descricao.split('\n')[1] # Procurando os elementos informativos de temperatura temperatura = soup.findAll(attrs={'class': 'BNeawe iBp4i AP7Wnd'}) temperatura = temperatura[1].text # Texto do segundo elemento # Criação do áudio informativo dependendo da linguagem if language == 'pt-br': cria_audio( f'A temperatura atual é de {temperatura} e está {descricao}', 'clima', language) else: # Se for em inglês, como as informações são em português, é utilizado a lib do Google Translator # para traduzir em inglês translate = Translator() descricao = translate.translate(descricao).text cria_audio( f'The current temperature is {temperatura} and is {descricao}', 'clima', language) ps(f'{path}/audios_{language}/clima.mp3' ) # Reproduzindo o áudio criado os.remove(f'{path}/audios_{language}/clima.mp3') # Excluindo o áudio except: reproduction_audio('erro', language) # Reproduz áudio de erro
def create(): create_sound = sound + 'create_tone.wav' ps(create_sound)
run = 0 else: print("INVALID ENTRY DETECTED, EXITING PROGRAM") run = 0 elif (choice == "X"): print("EXITING PROGRAM") radio.say("Goodbye") radio.runAndWait() quit() else: print("Invalid entry, please choose one of the options mentioned") #Sample Messages for Testing Purposes #msg = "HELLO THERE!" #mmsg = ".... . .-.. .-.. --- - .... . .-. ." #Fun Little Welcome Message ps(dot) ps(dash) #Initialize TextToSpeech radio = pyttsx3.init() radio.setProperty('rate', 150) radio.say("Welcome to Pi Dot Dash") radio.runAndWait() menu()
def __init__(signal): while not signal: ps('lol.mp3', False)
def switch(): mouse = mouse() if (kb.is_pressed("1")): ps(recording) while (not mouse.is_pressed("left")): x = 0 dict["BUSCAR"] = mouse.get_position() ps(recorded) elif (kb.is_pressed("2")): ps(recording) while (not mouse.is_pressed("left")): x = 0 dict["COLOR_ACEPTAR"] = dame_colores() dict["ACEPTAR"] = mouse.get_position() ps(recorded) #elif (kb.is_pressed("3")): # ps(recording) # while(not mouse.is_pressed("left")): # x=0 # dict["COLOR_RENDIRSE"] = dame_colores() # dict["RENDIRSE"] = mouse.get_position() # ps(recorded) elif (kb.is_pressed("3")): ps(recording) while (not mouse.is_pressed("left")): x = 0 dict["SEGURO"] = mouse.get_position() ps(recorded) elif (kb.is_pressed("4")): ps(recording) while (not mouse.is_pressed("left")): x = 0 dict["OTRA"] = mouse.get_position() ps(recorded)
def theard(): ps(f'{path}\\audios_{language}\\{save}.mp3')
click_sell.click() sell_html = driver.execute_script("return document.documentElement.outerHTML") sell_soup = BeautifulSoup(sell_html, 'html.parser') sell_rate = sell_soup.find("div", class_="_1cMg").get_text() sell_obj = re.findall("\d+\.\d+", sell_rate) sell_price = float(sell_obj[0]) sell_var = " Current Selling Price :" + " ₹" + str(sell_price) + "/g" print(sell_var) string_add_tax = str(add_tax) string_sell_price = str(sell_price) if add_tax <= 5039.00 : ps('alert.mp3') if sell_price >= 5029.00 : ps('alert.mp3') #########GRAPH DEF################# # def animate(i, xs, ys): # # # Read temperature (Celsius) from TMP102 # #temp_c = round(tmp102.read_temp(), 2) # price = add_tax # # # Add x and y to lists # xs.append(dt.datetime.now().strftime('%H:%M:%S.%f')) # ys.append(price) # Limit x and y lists to 20 items
import matplotlib.pyplot as plt import numpy as np import wave from playsound import playsound as ps audio = wave.open("delay1.wav") # Print out some basic information about the audio file print("\n//////////////////Info for original audio file//////////////////") print("Number of channels (1 for mono, 2 for stereo): " + str(audio.getnchannels())) print("Sample rate: " + str(audio.getframerate())) print("Total number of frames: " + str(audio.getnframes())) print("Length: " + str(round(audio.getnframes() / audio.getframerate(), 2)) + "s") print("Sample width: " + str(audio.getsampwidth()) + " bytes, or " + str(audio.getsampwidth() * 8) + " bits") print("////////////////////////////////////////////////////////////////\n") ps("delay3.wav")
def message(): message_sound = sound + 'message_tone.wav' ps(message_sound)
def login(): in_sound = sound + 'login_tone.wav' ps(in_sound)
def leave(): leave_sound = sound + 'leave_tone.wav' ps(leave_sound)
def switch(): switch_sound = sound + 'switch_tone.wav' ps(switch_sound)
def playMSFTAlert(): ps(constants.MSFTALERTPATH)
def main(): while True: system('mode con: cols=40 lines=7') print("Refreshing...") system('cls') #get buy price buy_rate = soup.find("div", class_="_1cMg").get_text() buy_obj = re.findall("\d+\.\d+", buy_rate) buy_price = float(buy_obj[0]) #add tax #add_tax_raw = ((buy_price * 3.0/100.0) + buy_price)/1000 add_tax_raw = (buy_price * 3.0/100.0) + buy_price add_tax = round(add_tax_raw, 2) print(" ") buy_var = " Buy Price including tax : " + "₹" + str(add_tax) + "/g" print(buy_var) print(" ") print("----------------------------------------") print(" ") #get sell price click_sell = driver.find_element_by_link_text('Sell') click_sell.click() sell_html = driver.execute_script("return document.documentElement.outerHTML") sell_soup = BeautifulSoup(sell_html, 'html.parser') sell_rate = sell_soup.find("div", class_="_1cMg").get_text() sell_obj = re.findall("\d+\.\d+", sell_rate) sell_price = float(sell_obj[0]) #sell_price = round(((float(sell_obj[0]))/1000), 2) sell_var = " Current Selling Price :" + " ₹" + str(sell_price) + "/g" print(sell_var) string_add_tax = str(add_tax) string_sell_price = str(sell_price) if add_tax <= 5039.00 : ps('alert.mp3') if sell_price >= 5029.00 : ps('alert.mp3') #dataset for ploting rate_list = open("y_axis_buy.txt", "a") #write to list L = [string_add_tax, "\n"] rate_list.writelines(L) rate_list.close() sell_list = open("y_axis_sell.txt", "a") M = [string_sell_price, "\n"] sell_list.writelines(M) sell_list.close() return add_tax, sell_price #i = i + 1 #num_gen.x_gen(i) #refresh driver.refresh() break
def logout(): out_sound = sound + 'logout_tone.wav' ps(out_sound)
def gameloop(): #game processing variables exitgame = False gameover = False score = 0 velocity_x = 0 velocity_y = 0 #fps = 30 snake_x = 100 snake_y = 150 food_x = r.randint(0, box_width) food_y = r.randint(0, box_height) #snake length snake_length = 1 snake_list = [] #game loop while exitgame != True: if gameover == True: #w.PlaySound("death.wav", w.SND_ALIAS ) #gives sound effects in windows #w.PlaySound(None, w.SND_PURGE) ps('end.mp3') #ps('',False) #ps('end.wav') #song = aus.from_file('end.wav', 'wav') #p(song) boxwindow.fill(grey) text_screen("GAME OVER!", "press ENTER to play again...", blue, yellow, 250, 160, 230, 200) #w.PlaySound("end.wav", w.SND_ASYNC | w.SND_ALIAS ) #gives sound effects in windows for event in pg.event.get(): if event.type == pg.QUIT: exitgame = True if event.type == pg.KEYDOWN: if event.key == pg.K_RETURN: #w.PlaySound(None, w.SND_ALIAS) gameloop() else: for event in pg.event.get(): if event.type == pg.QUIT: exitgame = True if event.type == pg.KEYDOWN: if event.key == pg.K_RIGHT: velocity_x = speed velocity_y = 0 #event.key != pg.K_LEFT if event.key == pg.K_LEFT: velocity_x = -speed velocity_y = 0 #event.key != pg.K_RIGHT if event.key == pg.K_UP: velocity_x = 0 velocity_y = -speed #event.key != pg.K_DOWN if event.key == pg.K_DOWN: velocity_x = 0 velocity_y = speed #event.key != pg.K_UP ''' for event in pg.event.get(): #if event.type == pg.KEYDOWN: if velocity_x == speed: pg.K_LEFT = False elif velocity_x == -speed: pg.K_RIGHT = False elif velocity_y == -speed: pg.K_DOWN = False else: pg.K_UP = False ''' #snake movement snake_x += velocity_x snake_y += velocity_y #collision or eating food #c = 10 if abs(snake_x - food_x) < 10 and abs(snake_y - food_y) < 10: #ps('stepdirt_1.wav',True) w.PlaySound("f.wav", w.SND_ASYNC | w.SND_ALIAS) #gives sound effects in windows score += 10 snake_length += 2 food_x = r.randint(0, box_width) food_y = r.randint(0, box_height) #c += 20 gamewindow.fill(grey) boxwindow.fill(white) text_screen("sNake GaMe", "score: " + str(score), green, red, 10, 5, 800, 5) pg.draw.rect(boxwindow, red, [food_x, food_y, 10, 10]) #snake head for length snake_head = [] snake_head.append(snake_x) snake_head.append(snake_y) snake_list.append(snake_head) #print(snake_list) if len( snake_list ) > snake_length: #if no. of lists of snake is more than snake length: del (snake_list[0]) #snake eating itself (game over) ''' for x in snake_list: if abs(x[1] - snake_head[1])<5 and abs(x[2] - snake_head[2])<5: exitgame = True ''' if (snake_head in snake_list[:-1] ) or (snake_x or snake_y) < 0 or (snake_x > box_width) or ( snake_y > box_height): #list[-1]or[:-1] -> starting from last item gameover = True snake(boxwindow, black, snake_list, snake_size) """ e=[i*i for i in range(1,6)] #print("e is " + str(e)) #print("e is " + str(e[-3:])) print("e is " + str(e[ :-1])) """ pg.display.update() clock.tick(fps) pg.quit() quit()
def join(): join_sound = sound + 'join_tone.wav' ps(join_sound)