-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGoodMorningG.py
61 lines (50 loc) · 1.65 KB
/
GoodMorningG.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from pathlib import Path
from time import sleep
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import pyttsx3
from playsound import playsound
from threading import Thread
from multiprocessing import Process
driverpath = '/Users/gabrielefiacconi/chromedriver/chromedriver 2'
name = 'Gabriele'
def speak(text):
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
engine.setProperty('rate', 300)
engine.say(text)
engine.runAndWait()
def open_browser():
driver = webdriver.Chrome(driverpath)
driver.maximize_window()
driver.get('https://www.ansa.it/')
driver.execute_script("window.open('');")
driver.switch_to.window(driver.window_handles[1])
driver.get("https://www.internazionale.it/")
driver.execute_script("window.open('');")
driver.switch_to.window(driver.window_handles[2])
driver.get("https://www.ilsole24ore.com/?refresh_ce=1")
driver.switch_to.window(driver.window_handles[0])
sleep(100000)
def playMusic(music):
playsound(music)
def alltogether():
music = 'acdc.mp3'
text = 'Good morning' + name + '! Here are the fucking Bullshit of today. Have a nice day!'
p1 = Process(target=open_browser)
p1.start()
p2 = Process(target=speak(text))
p2.start()
p3 = Process(target=playMusic(music))
p3.start()
p1.join()
p2.join()
p3.join()
if __name__ == '__main__':
try:
alltogether()
except Exception as e:
print(e)