-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask.py
More file actions
109 lines (88 loc) · 2.61 KB
/
Task.py
File metadata and controls
109 lines (88 loc) · 2.61 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
104
105
106
107
108
109
from Speak import Bol
import pyjokes
import weather
import datetime
from datetime import datetime as dt
from PyQt5.QtCore import Qt, QTime, QDate
import wikipedia
import pywhatkit
from News import news
def Time():
time = dt.now().strftime("%H:%M")
Bol(time)
def Date():
date = datetime.date.today()
Bol(date)
def Day():
day = dt.now().strftime("%A")
Bol(day)
def Joke(ref):
funny = pyjokes.get_joke()
ref.gui.speaker.setText(funny)
Bol(funny)
def music():
funny = pyjokes.get_joke()
Bol(funny)
def NonInputExecution(query, ref = None):
query = str(query)
if "time" in query:
Time()
elif "date" in query:
Date()
elif "day" in query:
Day()
elif "joke" in query:
Joke(ref)
elif "weather" in query:
weather.weathernews(ref)
elif "news" in query:
news(ref)
elif "music" in query:
music()
def wishMe(ref=None):
hour = int(dt.now().hour)
if hour >= 0 and hour <= 12:
Bol("Good Morning")
elif hour >= 12 and hour <= 18:
Bol("Good Afternoon")
else:
Bol("Good Evening")
ref.gui.listener.setText("Thinking...")
Bol("Jarvis here, Hello Sir")
Bol("Today is")
Day()
class Tasking:
def showTime(self):
current_time = QTime.currentTime()
current_date = QDate.currentDate()
label_time = current_time.toString("hh:mm:ss")
label_date = current_date.toString(Qt.ISODate)
self.gui.ojb_t1.setText(label_date)
self.gui.obj_t2.setText(label_time)
def InputExecution(tag, query,ref=None):
if "wikipedia" in tag:
try:
name = str(query).replace("about", "").replace("wikipedia", "")
result = wikipedia.summary(name, sentences=2)
ref.gui.speaker.setText(result)
Bol(result)
except:
Bol("Sorry, I could not find any result")
elif "music" in tag:
print("playing music...")
query = str(query).replace("youtube", "")
query = query.replace("on youtube", "")
pywhatkit.playonyt(query + "music")
elif "youtube" in tag:
print("youtubing...")
query = str(query).replace("youtube", "")
query = query.replace("on youtube", "")
pywhatkit.playonyt(query)
elif "google" in tag:
print("Googling...")
query = str(query).replace("google", "")
query = query.replace("google search", "")
query = query.replace("search", "")
query = query.replace("who is", "")
query = query.replace("about", "")
pywhatkit.search(query)