Updated Libraries & One Command requirements file

This commit is contained in:
2022-02-05 17:11:13 +05:30
parent 6e1d61f6a5
commit 0634ffcd6d
8 changed files with 150 additions and 28 deletions

12
Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
FROM python
WORKDIR /PSMBot-Virtual-Assistant
COPY /main.py .
COPY /weather.py .
COPY news.py .
COPY requirements.txt .
RUN pip install requirements.txt
CMD [ "python", "main.py" ]

Binary file not shown.

Binary file not shown.

View File

@@ -64,11 +64,6 @@ if __name__ == "__main__":
elif 'time' in command: elif 'time' in command:
time = datetime.datetime.now().strftime('%I:%M %p') time = datetime.datetime.now().strftime('%I:%M %p')
talk('Current time is ' + time) talk('Current time is ' + time)
elif 'search on wikipedia' in command:
search = command.replace('search on wikipedia', '')
info = wikipedia.summary(search, 6)
print('Searching ' + info)
talk(info)
elif 'search on google' in command: elif 'search on google' in command:
searchg = command.replace('search on google', '') searchg = command.replace('search on google', '')
pywhatkit.search(searchg) pywhatkit.search(searchg)

55
news.py Normal file
View File

@@ -0,0 +1,55 @@
import pyttsx3
import requests
import json
import time
url = ('https://newsapi.org/v2/top-headlines?'
'country = in&'
'apiKey =')
url += 'e3adedf2b3c54560b27338ef2bac6af8' #Your API key here
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)
rate = engine.getProperty('rate')
engine.setProperty('rate', 150)
try:
response = requests.get(url)
except:
engine.talk("can't access link, please check your internet ")
news = json.loads(response.text)
for new in news['articles']:
# print(str(new['title']), "\n\n")
news_title = (str(new['title']))
# print(str(new['description']), "\n\n")
news_description = (str(new['description']))
time.sleep(2)
# from urllib.request import urlopen
# from bs4 import BeautifulSoup as soup
# def news():
# try:
# news_url = "https://news.google.com/news/rss"
# Client = urlopen(news_url)
# xml_page = Client.read()
# Client.close()
# soup_page = soup(xml_page, "xml")
# news_list = soup_page.findAll("item")
# li = []
# for news in news_list[:15]:
# li.append(str(news.title.text.encode('utf-8'))[1:])
# return li
# except Exception as e:
# print(e)
# return False

31
notes.txt Normal file
View File

@@ -0,0 +1,31 @@
# import news
# from googlemaps import GoogleMaps
# elif 'news' in command:
# talk(news.news_title)
# print(news.news_title + '\n')
# print('-----------------------------------------------------------------------------------------\n')
# talk(news.news_description)
# print(news.news_description + '\n')
# print('-----------------------------------------------------------------------------------------\n')
# print(command)
# news_res = command.news()
# talk(f"I have found {len(news_res)} news. You can read it. Let me tell you first 2 of them")
# talk(news_res[0])
# print(news_res[0])
# talk(news_res[1])
# print(news_res[1])
# print(news_res)
# elif 'open maps' in command:
# command = command.replace('open maps', '')
# gmaps = GoogleMaps(api_key)
# print('Opening Maps...')
# talk('Opening Maps')
# print('What do you want to find?')
# talk('What do you want to find')
# local = gmaps.local_search(destination)
weather api key = "a4212b9586f6bf848e1c47839ebfc5e9"
wolframalpha = "JWP25T-Y434EXL697"

View File

@@ -1,6 +1,6 @@
# **Create your own virtual assistant with just a few lines code (Using only PYTHON)** # **Create your own virtual assistant with just a few lines code (Using only PYTHON)**
_`Last Updated: March 13' 2020`_ _`Last Updated: February 05' 2022`_
Hello & Welcome to this git page. Here I just created my own Hello & Welcome to this git page. Here I just created my own
virtual assistant with just a few lines of code. It is not an virtual assistant with just a few lines of code. It is not an
@@ -15,6 +15,7 @@ To learn more about how I did it you can watch my YouTube
video on this or [click here](https://www.youtube.com/channel/UCz6SDxk2KQqJAD6Ra_YPm6A). video on this or [click here](https://www.youtube.com/channel/UCz6SDxk2KQqJAD6Ra_YPm6A).
## Pre-Requisites: ## Pre-Requisites:
1. Python Interpreter (Like [PyCharm](https://www.jetbrains.com/pycharm/)) 1. Python Interpreter (Like [PyCharm](https://www.jetbrains.com/pycharm/))
2. Python Environment (Like [Anaconda](https://www.anaconda.com/products/individual)) 2. Python Environment (Like [Anaconda](https://www.anaconda.com/products/individual))
3. This [git repo](https://github.com/psavarmattas/PSMBot-Virtual-Assistant.git) 3. This [git repo](https://github.com/psavarmattas/PSMBot-Virtual-Assistant.git)
@@ -26,8 +27,6 @@ video on this or [click here](https://www.youtube.com/channel/UCz6SDxk2KQqJAD6Ra
-> [pywhatkit](https://pypi.org/project/pywhatkit/) -> [pywhatkit](https://pypi.org/project/pywhatkit/)
-> [wikipedia](https://pypi.org/project/wikipedia/)
-> [pyjokes](https://pypi.org/project/pyjokes/) -> [pyjokes](https://pypi.org/project/pyjokes/)
-> [wolframalpha](https://pypi.org/project/wolframalpha/) -> [wolframalpha](https://pypi.org/project/wolframalpha/)
@@ -47,21 +46,11 @@ resolved before opening an issues.
## Steps: ## Steps:
### For Windows users: ### For Windows users:
1. Open PyCharm & create a new project with your virtual environment ready. 1. Open PyCharm & create a new project with your virtual environment ready.
2. Open the terminal and paste the following in sequential order line by line(Execute it one by one): 2. Open the terminal and paste the command highlighted below:
`pip install speechRecognistion`
`pip install pyttsx3`
`pip install pywhatkit`
`pip install wikipedia`
`pip install pyjokes`
`pip install wolframalpha`
`pip install -r requirements.txt `
_Install this if necessary (Only when the code gives error)_ _Install this if necessary (Only when the code gives error)_
@@ -81,10 +70,10 @@ _(Note: Creating two different files for weather & main you will have to import
## Feature List (v2.0): ## Feature List (v2.0):
1. Play videos on YouTube. 1. Play videos on YouTube.
2. Search Wikipedia with your queries. 2. Search google with your queries.
3. Search google with your queries. 3. Listen to jokes.
4. Listen to jokes. 4. Ask for the weather (Anywhere in the world).
5. Ask for the weather (Anywhere in the world). 5. It can solve complex math problems for you.
6. It can solve complex math problems for you. 6. Ask it for today's date & time.
7. Ask it for today's date & time. 7. Say "thanks" or "thank you" and the assistant will appreciate you.
8. Say "thanks" or "thank you" and the assistant will appreciate you. 8. One command requirements install.

40
requirements.txt Normal file
View File

@@ -0,0 +1,40 @@
astroid @ file:///C:/ci/astroid_1639044403229/work
beautifulsoup4==4.9.3
certifi==2021.10.8
chardet==4.0.0
colorama @ file:///tmp/build/80754af9/colorama_1607707115595/work
comtypes==1.1.8
idna==2.10
isort @ file:///tmp/build/80754af9/isort_1628603791788/work
jaraco.context==4.0.0
lazy-object-proxy @ file:///C:/ci/lazy-object-proxy_1616529307648/work
mccabe==0.6.1
more-itertools==8.7.0
MouseInfo==0.1.3
Pillow==8.1.2
platformdirs @ file:///tmp/build/80754af9/platformdirs_1638968569495/work
PyAudio==0.2.11
PyAutoGUI==0.9.52
PyGetWindow==0.0.9
pyjokes==0.6.0
pylint @ file:///C:/ci/pylint_1639650750934/work
PyMsgBox==1.0.9
pyperclip==1.8.2
pypiwin32==223
PyRect==0.1.4
PyScreeze==0.1.26
pyttsx3==2.90
PyTweening==1.0.3
pywhatkit==3.9
pywin32==300
requests==2.25.1
six @ file:///tmp/build/80754af9/six_1623709665295/work
soupsieve==2.2
SpeechRecognition==3.8.1
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing-extensions @ file:///tmp/build/80754af9/typing_extensions_1631814937681/work
urllib3==1.26.3
wincertstore==0.2
wolframalpha==5.0.0
wrapt @ file:///C:/ci/wrapt_1638434029846/work
xmltodict==0.12.0