-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunc.py
More file actions
103 lines (79 loc) · 2.69 KB
/
Copy pathfunc.py
File metadata and controls
103 lines (79 loc) · 2.69 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
'''
CREATOR: KAPIL SHARMA
Mail - djkaps1707@gmail.com
Twitter - QapilS
Instagram - @qapil.sh04
Github - kuzuri-03
Telegram - kuzuri_17
'''
import sys, os, pyowm, pyttsx3, time, datetime, smtplib, wolframalpha
from data_store import *
#========================== Calculator Function ========================================
class Calc:
def add(num1,num2):
return num1 + num2
def sub(num1,num2):
return num1 - num2
def multi(num1,num2):
return num1 * num2
def div(num1,num2):
return num1 / num2
def sqr(num1,num2):
return num1 ** num2
def d_div(num1,num2):
return num1 // num2
#========================= Print Function ===============================================
def pr(sent):
print('\n' + 'JARVIS : ' + sent + '\n')
def pr_f(sent):
print('\n' + 'JARVIS : ' + sent)
def pr_l(sent):
print('JARVIS : ' + sent + '\n')
#========================= Speak Function ===============================================
client = wolframalpha.Client('[client ID]')
owm = pyowm.OWM('[API]')
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voices', voices[0].id)
rate = engine.getProperty('rate')
engine.setProperty('rate', 150)
engine.runAndWait()
def speak(audio):
os.system('color c')
engine.say(audio)
engine.runAndWait()
os.system('color a')
#========================== Play Music Function ===========================================
def playMusic():
music_dir = format(profile[4].replace('\n', ''))
songs = os.listdir(music_dir)
for music_list in songs:
pr(music_list)
os.startfile(os.path.join(music_dir, songs[0]))
#========================== Create Folder Function ========================================
def createFolder(directory):
try:
if not os.path.exists(directory):
os.makedirs(directory)
except:
print('Error in creating new folder - ' + directory)
#============================= Alarm Function =============================================
def alarm():
hour = int(input('Enter hour: '))
min = int(input('Enter minute: '))
sec = int(input('Enter seconds: '))
print(f'Alarm is set for {hour}:{min}:{sec}')
while True:
if time.localtime().tm_hour==hour and time.localtime().tm_min == min and time.localtime().tm_sec == sec:
print('Wake UP')
speak('Wake UP')
break
playMusic()
#========================== Send Email Function ========================================
def sendEmail(to, content):
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.login('[your email]', '[your password]')
server.sendmail('[your email]', to, content)
server.close()